]> 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>
Sun, 7 Apr 2024 19:55:56 +0000 (19:55 +0000)
commitcc78b77c715d6ef62693d4c1bc7190da990ec0fa
treef3ab002ffa2b1fbe95dcaec8409b5ac203e21a9f
parentb8b1ef3149f26992625a03d45c0307bfad70e8bd
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