invoices: expose AMPRecord() method on Payload
This commit is contained in:
parent
055db6b9ac
commit
464dff09ac
@ -86,6 +86,10 @@ type Payload struct {
|
|||||||
// a TLV onion payload.
|
// a TLV onion payload.
|
||||||
MPP *record.MPP
|
MPP *record.MPP
|
||||||
|
|
||||||
|
// AMP holds the info provided in an option_amp record when parsed from
|
||||||
|
// a TLV onion payload.
|
||||||
|
AMP *record.AMP
|
||||||
|
|
||||||
// customRecords are user-defined records in the custom type range that
|
// customRecords are user-defined records in the custom type range that
|
||||||
// were included in the payload.
|
// were included in the payload.
|
||||||
customRecords record.CustomSet
|
customRecords record.CustomSet
|
||||||
@ -250,6 +254,12 @@ func (h *Payload) MultiPath() *record.MPP {
|
|||||||
return h.MPP
|
return h.MPP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AMPRecord returns the record corresponding with option_amp parsed from the
|
||||||
|
// onion payload.
|
||||||
|
func (h *Payload) AMPRecord() *record.AMP {
|
||||||
|
return h.AMP
|
||||||
|
}
|
||||||
|
|
||||||
// CustomRecords returns the custom tlv type records that were parsed from the
|
// CustomRecords returns the custom tlv type records that were parsed from the
|
||||||
// payload.
|
// payload.
|
||||||
func (h *Payload) CustomRecords() record.CustomSet {
|
func (h *Payload) CustomRecords() record.CustomSet {
|
||||||
|
@ -11,6 +11,10 @@ type Payload interface {
|
|||||||
// the onion payload.
|
// the onion payload.
|
||||||
MultiPath() *record.MPP
|
MultiPath() *record.MPP
|
||||||
|
|
||||||
|
// AMPRecord returns the record corresponding to the option_amp record
|
||||||
|
// parsed from the onion payload.
|
||||||
|
AMPRecord() *record.AMP
|
||||||
|
|
||||||
// CustomRecords returns the custom tlv type records that were parsed
|
// CustomRecords returns the custom tlv type records that were parsed
|
||||||
// from the payload.
|
// from the payload.
|
||||||
CustomRecords() record.CustomSet
|
CustomRecords() record.CustomSet
|
||||||
|
@ -802,6 +802,7 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash,
|
|||||||
finalCltvRejectDelta: i.cfg.FinalCltvRejectDelta,
|
finalCltvRejectDelta: i.cfg.FinalCltvRejectDelta,
|
||||||
customRecords: payload.CustomRecords(),
|
customRecords: payload.CustomRecords(),
|
||||||
mpp: payload.MultiPath(),
|
mpp: payload.MultiPath(),
|
||||||
|
amp: payload.AMPRecord(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process keysend if present. Do this outside of the lock, because
|
// Process keysend if present. Do this outside of the lock, because
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
type mockPayload struct {
|
type mockPayload struct {
|
||||||
mpp *record.MPP
|
mpp *record.MPP
|
||||||
|
amp *record.AMP
|
||||||
customRecords record.CustomSet
|
customRecords record.CustomSet
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,6 +31,10 @@ func (p *mockPayload) MultiPath() *record.MPP {
|
|||||||
return p.mpp
|
return p.mpp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *mockPayload) AMPRecord() *record.AMP {
|
||||||
|
return p.amp
|
||||||
|
}
|
||||||
|
|
||||||
func (p *mockPayload) CustomRecords() record.CustomSet {
|
func (p *mockPayload) CustomRecords() record.CustomSet {
|
||||||
// This function should always return a map instance, but for mock
|
// This function should always return a map instance, but for mock
|
||||||
// configuration we do accept nil.
|
// configuration we do accept nil.
|
||||||
|
@ -20,6 +20,7 @@ type invoiceUpdateCtx struct {
|
|||||||
finalCltvRejectDelta int32
|
finalCltvRejectDelta int32
|
||||||
customRecords record.CustomSet
|
customRecords record.CustomSet
|
||||||
mpp *record.MPP
|
mpp *record.MPP
|
||||||
|
amp *record.AMP
|
||||||
}
|
}
|
||||||
|
|
||||||
// invoiceRef returns an identifier that can be used to lookup or update the
|
// invoiceRef returns an identifier that can be used to lookup or update the
|
||||||
@ -34,8 +35,9 @@ func (i *invoiceUpdateCtx) invoiceRef() channeldb.InvoiceRef {
|
|||||||
|
|
||||||
// log logs a message specific to this update context.
|
// log logs a message specific to this update context.
|
||||||
func (i *invoiceUpdateCtx) log(s string) {
|
func (i *invoiceUpdateCtx) log(s string) {
|
||||||
log.Debugf("Invoice%v: %v, amt=%v, expiry=%v, circuit=%v, mpp=%v",
|
log.Debugf("Invoice%v: %v, amt=%v, expiry=%v, circuit=%v, mpp=%v, "+
|
||||||
i.invoiceRef, s, i.amtPaid, i.expiry, i.circuitKey, i.mpp)
|
"amp=%v", i.hash[:], s, i.amtPaid, i.expiry, i.circuitKey,
|
||||||
|
i.mpp, i.amp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// failRes is a helper function which creates a failure resolution with
|
// failRes is a helper function which creates a failure resolution with
|
||||||
|
Loading…
Reference in New Issue
Block a user