Merge pull request #3609 from bitromortac/fwdinghistory-msat-amounts

lnd+lnrpc: add msat forwarding amount fields to ForwardingHistory
This commit is contained in:
Conner Fromknecht 2019-10-18 09:16:44 +02:00 committed by GitHub
commit 21a40daf58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 581 additions and 542 deletions

File diff suppressed because it is too large Load diff

View file

@ -2498,6 +2498,13 @@ message ForwardingEvent {
/// The total fee (in milli-satoshis) that this payment circuit carried.
uint64 fee_msat = 8 [json_name = "fee_msat"];
/// The total amount (in milli-satoshis) of the incoming HTLC that created half the circuit.
uint64 amt_in_msat = 9 [json_name = "amt_in_msat"];
/// The total amount (in milli-satoshis) of the outgoing HTLC that created the second half of the circuit.
uint64 amt_out_msat = 10 [json_name = "amt_out_msat"];
// TODO(roasbeef): add settlement latency?
// * use FPE on the chan id?
// * also list failures?

View file

@ -2163,6 +2163,16 @@
"type": "string",
"format": "uint64",
"description": "/ The total fee (in milli-satoshis) that this payment circuit carried."
},
"amt_in_msat": {
"type": "string",
"format": "uint64",
"description": "/ The total amount (in milli-satoshis) of the incoming HTLC that created half the circuit."
},
"amt_out_msat": {
"type": "string",
"format": "uint64",
"description": "/ The total amount (in milli-satoshis) of the outgoing HTLC that created the second half of the circuit."
}
}
},

View file

@ -4723,18 +4723,20 @@ func (r *rpcServer) ForwardingHistory(ctx context.Context,
LastOffsetIndex: timeSlice.LastIndexOffset,
}
for i, event := range timeSlice.ForwardingEvents {
amtInSat := event.AmtIn.ToSatoshis()
amtOutSat := event.AmtOut.ToSatoshis()
amtInMsat := event.AmtIn
amtOutMsat := event.AmtOut
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(amtInSat),
AmtOut: uint64(amtOutSat),
Fee: uint64(feeMsat.ToSatoshis()),
FeeMsat: uint64(feeMsat),
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),
}
}