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:
Yaacov Akiba Slama authored and Olaoluwa Osuntokun committed 2021-03-05 16:26:28 -08:00
1 parent 3c14e3d71d
commit 4bab68a808
4 files changed
+817 -795

No files matched your search

+10 -9
View File
@@ -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),
}
}