Add a `required_vec` TLV deserialization type
authorMatt Corallo <git@bluematt.me>
Fri, 7 Jul 2023 18:38:06 +0000 (18:38 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 7 Jul 2023 21:06:52 +0000 (21:06 +0000)
commit32846d33db1c402d6eb7a268ab0dbc717db39232
tree8cb9d3514cd3b9e03cf6b975bfe1d2ca31438583
parent46913daa38fe551b284a0c1f791ca917fb731340
Add a `required_vec` TLV deserialization type

Historically, we used `vec_type` for all TLV Vec reads/writes, but
it is asymmetric and thus somewhat confusing - on the write side it
always writes a TLV entry, even if there are zero elements. On the
read side, it happily accepts a missing TLV, providing a
zero-length vector.

In 85b573ddad70f3c5ee36e0992d587842af507a8d a new `optional_vec`
TLV format was added which was symmetric, but only supports
optional vecs. This adds the corresponding required form, always
writing a TLV and ensuring it is present.
lightning/src/util/ser_macros.rs