mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-21 14:04:06 +01:00
lnwire: sort records in ExtractRecords
This ensures that the caller doesn't need to worry about the TLV type ordering of the records the pass into the function.
This commit is contained in:
parent
25dfbadd23
commit
7ae4bf0672
1 changed files with 4 additions and 0 deletions
|
@ -90,6 +90,10 @@ func (e *ExtraOpaqueData) ExtractRecords(recordProducers ...tlv.RecordProducer)
|
|||
records = append(records, producer.Record())
|
||||
}
|
||||
|
||||
// Ensure that the set of records are sorted before we attempt to
|
||||
// decode from the stream, to ensure they're canonical.
|
||||
tlv.SortRecords(records)
|
||||
|
||||
extraBytesReader := bytes.NewReader(*e)
|
||||
|
||||
tlvStream, err := tlv.NewStream(records...)
|
||||
|
|
Loading…
Add table
Reference in a new issue