mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-02 23:15:36 +02:00
routing+channeldb: send payment metadata from invoice
This commit is contained in:
@@ -1141,6 +1141,10 @@ func serializeHop(w io.Writer, h *route.Hop) error {
|
||||
records = append(records, h.MPP.Record())
|
||||
}
|
||||
|
||||
if h.Metadata != nil {
|
||||
records = append(records, record.NewMetadataRecord(&h.Metadata))
|
||||
}
|
||||
|
||||
// Final sanity check to absolutely rule out custom records that are not
|
||||
// custom and write into the standard range.
|
||||
if err := h.CustomRecords.Validate(); err != nil {
|
||||
@@ -1255,6 +1259,13 @@ func deserializeHop(r io.Reader) (*route.Hop, error) {
|
||||
h.MPP = mpp
|
||||
}
|
||||
|
||||
metadataType := uint64(record.MetadataOnionType)
|
||||
if metadata, ok := tlvMap[metadataType]; ok {
|
||||
delete(tlvMap, metadataType)
|
||||
|
||||
h.Metadata = metadata
|
||||
}
|
||||
|
||||
h.CustomRecords = tlvMap
|
||||
|
||||
return h, nil
|
||||
|
Reference in New Issue
Block a user