mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
lnrpc: add timestamp_ns field to ForwardingEvent msg
This allows to use FowardingHistory rpc method to receive the data exactly as it's stored in lnd and to synchronize incrementally the history to an external database.
This commit is contained in:
parent
3c14e3d71d
commit
4bab68a808
1578
lnrpc/rpc.pb.go
1578
lnrpc/rpc.pb.go
File diff suppressed because it is too large
Load Diff
@ -3427,8 +3427,8 @@ message ForwardingHistoryRequest {
|
||||
}
|
||||
message ForwardingEvent {
|
||||
// Timestamp is the time (unix epoch offset) that this circuit was
|
||||
// completed.
|
||||
uint64 timestamp = 1;
|
||||
// completed. Deprecated by timestamp_ns.
|
||||
uint64 timestamp = 1 [deprecated = true];
|
||||
|
||||
// The incoming channel ID that carried the HTLC that created the circuit.
|
||||
uint64 chan_id_in = 2 [jstype = JS_STRING];
|
||||
@ -3459,6 +3459,10 @@ message ForwardingEvent {
|
||||
// the second half of the circuit.
|
||||
uint64 amt_out_msat = 10;
|
||||
|
||||
// The number of nanoseconds elapsed since January 1, 1970 UTC when this
|
||||
// circuit was completed.
|
||||
uint64 timestamp_ns = 11;
|
||||
|
||||
// TODO(roasbeef): add settlement latency?
|
||||
// * use FPE on the chan id?
|
||||
// * also list failures?
|
||||
|
@ -3557,7 +3557,7 @@
|
||||
"timestamp": {
|
||||
"type": "string",
|
||||
"format": "uint64",
|
||||
"description": "Timestamp is the time (unix epoch offset) that this circuit was\ncompleted."
|
||||
"description": "Timestamp is the time (unix epoch offset) that this circuit was\ncompleted. Deprecated by timestamp_ns."
|
||||
},
|
||||
"chan_id_in": {
|
||||
"type": "string",
|
||||
@ -3598,6 +3598,11 @@
|
||||
"type": "string",
|
||||
"format": "uint64",
|
||||
"description": "The total amount (in milli-satoshis) of the outgoing HTLC that created\nthe second half of the circuit."
|
||||
},
|
||||
"timestamp_ns": {
|
||||
"type": "string",
|
||||
"format": "uint64",
|
||||
"description": "The number of nanoseconds elapsed since January 1, 1970 UTC when this\ncircuit was completed."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
19
rpcserver.go
19
rpcserver.go
@ -6139,15 +6139,16 @@ func (r *rpcServer) ForwardingHistory(ctx context.Context,
|
||||
feeMsat := event.AmtIn - event.AmtOut
|
||||
|
||||
resp.ForwardingEvents[i] = &lnrpc.ForwardingEvent{
|
||||
Timestamp: uint64(event.Timestamp.Unix()),
|
||||
ChanIdIn: event.IncomingChanID.ToUint64(),
|
||||
ChanIdOut: event.OutgoingChanID.ToUint64(),
|
||||
AmtIn: uint64(amtInMsat.ToSatoshis()),
|
||||
AmtOut: uint64(amtOutMsat.ToSatoshis()),
|
||||
Fee: uint64(feeMsat.ToSatoshis()),
|
||||
FeeMsat: uint64(feeMsat),
|
||||
AmtInMsat: uint64(amtInMsat),
|
||||
AmtOutMsat: uint64(amtOutMsat),
|
||||
Timestamp: uint64(event.Timestamp.Unix()),
|
||||
TimestampNs: uint64(event.Timestamp.UnixNano()),
|
||||
ChanIdIn: event.IncomingChanID.ToUint64(),
|
||||
ChanIdOut: event.OutgoingChanID.ToUint64(),
|
||||
AmtIn: uint64(amtInMsat.ToSatoshis()),
|
||||
AmtOut: uint64(amtOutMsat.ToSatoshis()),
|
||||
Fee: uint64(feeMsat.ToSatoshis()),
|
||||
FeeMsat: uint64(feeMsat),
|
||||
AmtInMsat: uint64(amtInMsat),
|
||||
AmtOutMsat: uint64(amtOutMsat),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user