mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 22:54:25 +01:00
wire: rename var_int to bigsize, and insist on minimal.
The new TLV spec uses BigSize, like Bitcoin's CompactInt but *little-endian*. So change our name for clarity, and insist that decoding be minimal as the spec requires. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1057,7 +1057,7 @@ tlv__type_impl_fromwire_template = """static struct {tlv_name} *fromwire__{tlv_n
|
||||
|
||||
\twhile (*plen) {{
|
||||
\t\tmsg_type = fromwire_u8(p, plen);
|
||||
\t\tmsg_len = fromwire_var_int(p, plen);
|
||||
\t\tmsg_len = fromwire_bigsize(p, plen);
|
||||
\t\tif (*plen < msg_len) {{
|
||||
\t\t\tfromwire_fail(p, plen);
|
||||
\t\t\tbreak;
|
||||
@@ -1103,7 +1103,7 @@ print_tlv_template = """static void printwire_{tlv_name}(const char *fieldname,
|
||||
|
||||
\twhile (cursor) {{
|
||||
\t\tmsg_type = fromwire_u8(&cursor, &plen);
|
||||
\t\tmsg_size = fromwire_var_int(&cursor, &plen);
|
||||
\t\tmsg_size = fromwire_bigsize(&cursor, &plen);
|
||||
\t\tif (!cursor)
|
||||
\t\t\tbreak;
|
||||
\t\tswitch ((enum {tlv_name}_type)msg_type) {{
|
||||
|
||||
Reference in New Issue
Block a user