Commit Graph

2 Commits

Author SHA1 Message Date
Matheus Degiovani
44555a70ed lnwire: fix decoding for initial zero sid
This fixes a decoding error when the list of short channel ids within a
QueryShortChanIDs message started with a zero sid.

BOLT-0007 specifies that lists of short channel ids should be sorted in
ascending order. Previously, this was checked within lnwire by comparing
two consecutive sids in the list, starting at the empty (zero) sid.

This meant that a list that started with a zero sid couldn't be decoded
since the first element would _not_ be greater than the last one
(namely: also zero).

Given that one can only check for ordering starting at the second
element, we add a check to ensure the proper behavior.

A unit test is also added to ensure no future regressions on this
behavior.
2020-06-18 14:04:39 -03:00
Conner Fromknecht
3cc235a349
lnwire/query_short_chan_ids: assert sorted for plain encoding 2019-11-20 01:57:36 -08:00