htlcswitch+invoices: log payment metadata
This commit is contained in:
6 files changed
+75
-14
No files matched your search
@@ -18,4 +18,8 @@ type Payload interface {
|
||||
// CustomRecords returns the custom tlv type records that were parsed
|
||||
// from the payload.
|
||||
CustomRecords() record.CustomSet
|
||||
|
||||
// Metadata returns the additional data that is sent along with the
|
||||
// payment to the payee.
|
||||
Metadata() []byte
|
||||
}
|
||||
@@ -906,6 +906,7 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash,
|
||||
customRecords: payload.CustomRecords(),
|
||||
mpp: payload.MultiPath(),
|
||||
amp: payload.AMPRecord(),
|
||||
metadata: payload.Metadata(),
|
||||
}
|
||||
|
||||
switch {
|
||||
|
||||
@@ -30,6 +30,7 @@ type mockPayload struct {
|
||||
mpp *record.MPP
|
||||
amp *record.AMP
|
||||
customRecords record.CustomSet
|
||||
metadata []byte
|
||||
}
|
||||
|
||||
func (p *mockPayload) MultiPath() *record.MPP {
|
||||
@@ -50,6 +51,10 @@ func (p *mockPayload) CustomRecords() record.CustomSet {
|
||||
return p.customRecords
|
||||
}
|
||||
|
||||
func (p *mockPayload) Metadata() []byte {
|
||||
return p.metadata
|
||||
}
|
||||
|
||||
const (
|
||||
testHtlcExpiry = uint32(5)
|
||||
|
||||
|
||||
+11
-2
@@ -1,6 +1,7 @@
|
||||
package invoices
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
|
||||
"github.com/lightningnetwork/lnd/amp"
|
||||
@@ -22,6 +23,7 @@ type invoiceUpdateCtx struct {
|
||||
customRecords record.CustomSet
|
||||
mpp *record.MPP
|
||||
amp *record.AMP
|
||||
metadata []byte
|
||||
}
|
||||
|
||||
// invoiceRef returns an identifier that can be used to lookup or update the
|
||||
@@ -52,9 +54,16 @@ func (i invoiceUpdateCtx) setID() *[32]byte {
|
||||
|
||||
// log logs a message specific to this update context.
|
||||
func (i *invoiceUpdateCtx) log(s string) {
|
||||
// Don't use %x in the log statement below, because it doesn't
|
||||
// distinguish between nil and empty metadata.
|
||||
metadata := "<nil>"
|
||||
if i.metadata != nil {
|
||||
metadata = hex.EncodeToString(i.metadata)
|
||||
}
|
||||
|
||||
log.Debugf("Invoice%v: %v, amt=%v, expiry=%v, circuit=%v, mpp=%v, "+
|
||||
"amp=%v", i.invoiceRef(), s, i.amtPaid, i.expiry, i.circuitKey,
|
||||
i.mpp, i.amp)
|
||||
"amp=%v, metadata=%v", i.invoiceRef(), s, i.amtPaid, i.expiry,
|
||||
i.circuitKey, i.mpp, i.amp, metadata)
|
||||
}
|
||||
|
||||
// failRes is a helper function which creates a failure resolution with
|
||||
|
||||
Reference in new issue
Block a user