routing+channeldb: send payment metadata from invoice
This commit is contained in:
17 files changed
+1580
-1401
No files matched your search
@@ -16,6 +16,10 @@ const (
|
||||
// NextHopOnionType is the type used in the onion to reference the ID
|
||||
// of the next hop.
|
||||
NextHopOnionType tlv.Type = 6
|
||||
|
||||
// MetadataOnionType is the type used in the onion for the payment
|
||||
// metadata.
|
||||
MetadataOnionType tlv.Type = 16
|
||||
)
|
||||
|
||||
// NewAmtToFwdRecord creates a tlv.Record that encodes the amount_to_forward
|
||||
@@ -45,3 +49,15 @@ func NewLockTimeRecord(lockTime *uint32) tlv.Record {
|
||||
func NewNextHopIDRecord(cid *uint64) tlv.Record {
|
||||
return tlv.MakePrimitiveRecord(NextHopOnionType, cid)
|
||||
}
|
||||
|
||||
// NewMetadataRecord creates a tlv.Record that encodes the metadata (type 10)
|
||||
// for an onion payload.
|
||||
func NewMetadataRecord(metadata *[]byte) tlv.Record {
|
||||
return tlv.MakeDynamicRecord(
|
||||
MetadataOnionType, metadata,
|
||||
func() uint64 {
|
||||
return uint64(len(*metadata))
|
||||
},
|
||||
tlv.EVarBytes, tlv.DVarBytes,
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user