mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
channeldb: custom records sanity check
This commit is contained in:
parent
d16476e477
commit
de2b7b78de
2 changed files with 11 additions and 2 deletions
|
@ -607,6 +607,15 @@ func serializeHop(w io.Writer, h *route.Hop) error {
|
||||||
records = append(records, h.MPP.Record())
|
records = append(records, h.MPP.Record())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert custom records to tlv and add to the record list.
|
||||||
|
// MapToRecords sorts the list, so adding it here will keep the list
|
||||||
|
// canonical.
|
||||||
tlvRecords := tlv.MapToRecords(h.CustomRecords)
|
tlvRecords := tlv.MapToRecords(h.CustomRecords)
|
||||||
records = append(records, tlvRecords...)
|
records = append(records, tlvRecords...)
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ var (
|
||||||
OutgoingTimeLock: 111,
|
OutgoingTimeLock: 111,
|
||||||
AmtToForward: 555,
|
AmtToForward: 555,
|
||||||
CustomRecords: record.CustomSet{
|
CustomRecords: record.CustomSet{
|
||||||
1: []byte{},
|
65536: []byte{},
|
||||||
2: []byte{},
|
80001: []byte{},
|
||||||
},
|
},
|
||||||
MPP: record.NewMPP(32, [32]byte{0x42}),
|
MPP: record.NewMPP(32, [32]byte{0x42}),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue