mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
tlv: it's ok to be odd
fail if a message type is even and it's not included. otherwise, continue with the next message type.
This commit is contained in:
committed by
Rusty Russell
parent
b89ea071e8
commit
d8738452ed
@@ -863,9 +863,13 @@ tlv__type_impl_fromwire_template = """static struct {tlv_name} *fromwire__{tlv_n
|
|||||||
\t\t}}
|
\t\t}}
|
||||||
\t\tswitch((enum {tlv_name}_type)msg_type) {{
|
\t\tswitch((enum {tlv_name}_type)msg_type) {{
|
||||||
{cases}\t\tdefault:
|
{cases}\t\tdefault:
|
||||||
\t\t\t// FIXME: print a warning / message?
|
\t\t\tif (msg_type % 2 == 0) {{ // it's ok to be odd
|
||||||
|
\t\t\t\tfromwire_fail(p, plen);
|
||||||
|
\t\t\t\ttal_free({tlv_name});
|
||||||
|
\t\t\t\treturn NULL;
|
||||||
|
\t\t\t}}
|
||||||
\t\t\t*p += msg_len;
|
\t\t\t*p += msg_len;
|
||||||
\t\t\tplen -= msg_len;
|
\t\t\t*plen -= msg_len;
|
||||||
\t\t}}
|
\t\t}}
|
||||||
\t}}
|
\t}}
|
||||||
\tif (!*p) {{
|
\tif (!*p) {{
|
||||||
|
|||||||
Reference in New Issue
Block a user