Use a variable-length integer for many serialization wrappers 2023-01-ser-cleanups
authorMatt Corallo <git@bluematt.me>
Mon, 28 Nov 2022 01:00:38 +0000 (01:00 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 17 Jan 2023 21:48:23 +0000 (21:48 +0000)
commit3e9727b808814e6a6656a071a247695d9d95c572
tree2c88dadc71c0118482100786fbd45aa3313deed7
parentb75a558a1de8e575bd501ccc64382e5b075c471e
Use a variable-length integer for many serialization wrappers

The lightning protocol uses u16s for lengths in most cases. As our
serialization framework primarily targets that, we must as well.
However, because we may serialize objects that have  more than 65K
entries, we want to be able to store larger values. Thus, we define
a variable length integer here which is backwards-compatible but
treats 0xffff as "read eight more bytes".

This doesn't address any specific known issue, but feels like good
practice just in case.
lightning/src/util/ser.rs