mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 21:35:24 +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
@ -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…
Reference in New Issue
Block a user