htlcswitch: add incoming+outgoing amounts to the PaymentCircuit

In this commit, we add the incoming+outgoing amounts if the HTLC’s that
the payment circuit consists of. With these new fields, we’ll be able
to populate the forwarding event log once the payment circuit has been
successfully completed.
This commit is contained in:
Olaoluwa Osuntokun 2018-02-27 22:11:20 -08:00
parent 744cfd2ce5
commit 2b8cad2f08
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -16,26 +16,36 @@ type PaymentCircuit struct {
// PaymentHash used as unique identifier of payment. // PaymentHash used as unique identifier of payment.
PaymentHash [32]byte PaymentHash [32]byte
// IncomingChanID identifies the channel from which add HTLC request came // IncomingChanID identifies the channel from which add HTLC request
// and to which settle/fail HTLC request will be returned back. Once // came and to which settle/fail HTLC request will be returned back.
// the switch forwards the settle/fail message to the src the circuit // Once the switch forwards the settle/fail message to the src the
// is considered to be completed. // circuit is considered to be completed.
IncomingChanID lnwire.ShortChannelID IncomingChanID lnwire.ShortChannelID
// IncomingHTLCID is the ID in the update_add_htlc message we received from // IncomingHTLCID is the ID in the update_add_htlc message we received
// the incoming channel, which will be included in any settle/fail messages // from the incoming channel, which will be included in any settle/fail
// we send back. // messages we send back.
IncomingHTLCID uint64 IncomingHTLCID uint64
// OutgoingChanID identifies the channel to which we propagate the HTLC add // IncomingAmt is the value of the incoming HTLC. If we take this and
// update and from which we are expecting to receive HTLC settle/fail // subtract it from the OutgoingAmt, then we'll compute the total fee
// request back. // attached to this payment circuit.
IncomingAmt lnwire.MilliSatoshi
// OutgoingChanID identifies the channel to which we propagate the HTLC
// add update and from which we are expecting to receive HTLC
// settle/fail request back.
OutgoingChanID lnwire.ShortChannelID OutgoingChanID lnwire.ShortChannelID
// OutgoingHTLCID is the ID in the update_add_htlc message we sent to the // OutgoingHTLCID is the ID in the update_add_htlc message we sent to
// outgoing channel. // the outgoing channel.
OutgoingHTLCID uint64 OutgoingHTLCID uint64
// OutgoingAmt is the value of the outgoing HTLC. If we subtract this
// from the IncomingAmt, then we'll compute the total fee attached to
// this payment circuit.
OutgoingAmt lnwire.MilliSatoshi
// ErrorEncrypter is used to re-encrypt the onion failure before // ErrorEncrypter is used to re-encrypt the onion failure before
// sending it back to the originator of the payment. // sending it back to the originator of the payment.
ErrorEncrypter ErrorEncrypter ErrorEncrypter ErrorEncrypter