Fix future unknown `Event` variant backwards compatibility 2021-09-event-backwards-compat-fix
authorMatt Corallo <git@bluematt.me>
Tue, 21 Sep 2021 17:48:40 +0000 (17:48 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 21 Sep 2021 20:37:35 +0000 (20:37 +0000)
commit71e0173d8db17116a1a17517b40512be8c05af50
tree0ac85774ab1215a3557e5d51cc2c23e6227c4e4e
parent2cf42aa3888e665541faf34a634f054b4580d25f
Fix future unknown `Event` variant backwards compatibility

In 8ffc2d1742ff1171a87b0410b21cbbd557ff8247, in 0.0.100, we added
a backwards compatibility feature to the reading of `Event`s - if
the type was unknown and odd, we'd simply ignore the event and
treat it as no event. However, we failed to read the
length-prefixed TLV stream when doing so, resulting in us reading
some of the skipped-event data as the next event or other data in
the ChannelManager.

We fix this by reading the varint length prefix written, then
skipping that many bytes when we come across an unknown odd event
type.
lightning/src/util/events.rs