Fix TLV serialization to work with large types.
authorValentine Wallace <vwallace@protonmail.com>
Tue, 22 Jun 2021 20:50:18 +0000 (16:50 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Thu, 24 Jun 2021 20:25:31 +0000 (16:25 -0400)
commit40959b74b78dd2cf99547c10d2888ce014930b3d
tree37d484df285319c664e443bd166d4ea0a0753081
parentbfd9646092e3c63f07d96df35dd72488af55a176
Fix TLV serialization to work with large types.

Previous to this PR, TLV serialization involved iterating from 0 to the highest
given TLV type. This worked until we decided to implement keysend, which has a
TLV type of ~5.48 billion.

So instead, we now specify the type of whatever is being (de)serialized (which
can be an Option, a Vec type, or a non-Option (specified in the serialization macros as "required").
12 files changed:
lightning/src/chain/channelmonitor.rs
lightning/src/chain/keysinterface.rs
lightning/src/chain/onchaintx.rs
lightning/src/chain/package.rs
lightning/src/ln/chan_utils.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/msgs.rs
lightning/src/routing/network_graph.rs
lightning/src/routing/router.rs
lightning/src/util/events.rs
lightning/src/util/ser_macros.rs