]> git.bitcoin.ninja Git - rust-lightning/commit
Fix unknown handling in `impl_writeable_tlv_based_enum_upgradable`
authorMatt Corallo <git@bluematt.me>
Tue, 26 Mar 2024 15:08:20 +0000 (15:08 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 8 Apr 2024 16:10:59 +0000 (16:10 +0000)
commit499ca937acf9adc18e4f874add0c21c9a79bb64b
tree0e64314a02adb36046da176a08692bbc6ddf0bf0
parent4bab9c8393345805ef36367cdb10a3a569f365fc
Fix unknown handling in `impl_writeable_tlv_based_enum_upgradable`

`impl_writeable_tlv_based_enum_upgradable` professed to supporting
upgrades by returning `None` from `MaybeReadable` when unknown
variants written by newer versions of LDK were read. However, it
generally didn't support this as it didn't discard bytes for
unknown types, resulting in corrupt reading.

This is fixed here for enum variants written as a TLV stream,
however we don't have a length prefix for tuple enum variants, so
the documentation on the macro is updated to mention that
downgrades are not supported for tuple variants.
lightning/src/util/ser_macros.rs