mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +01:00
tlv: remove requirement of having tlv_name
This commit is contained in:
parent
de2fb7c9ef
commit
94395c6a9a
1 changed files with 5 additions and 5 deletions
|
@ -411,7 +411,7 @@ class Message(object):
|
||||||
subcalls.append('fromwire_{}({}cursor, {}plen, {} + i);'
|
subcalls.append('fromwire_{}({}cursor, {}plen, {} + i);'
|
||||||
.format(basetype, p_ref, p_ref, name))
|
.format(basetype, p_ref, p_ref, name))
|
||||||
|
|
||||||
def print_fromwire(self, is_header, tlv_name):
|
def print_fromwire(self, is_header):
|
||||||
ctx_arg = 'const tal_t *ctx, ' if self.has_variable_fields else ''
|
ctx_arg = 'const tal_t *ctx, ' if self.has_variable_fields else ''
|
||||||
|
|
||||||
args = []
|
args = []
|
||||||
|
@ -530,7 +530,7 @@ class Message(object):
|
||||||
def find_tlv_lenvar_field(self, tlv_name):
|
def find_tlv_lenvar_field(self, tlv_name):
|
||||||
return [f for f in self.fields if f.is_len_var and f.lenvar_for.is_tlv and f.lenvar_for.name == tlv_name][0]
|
return [f for f in self.fields if f.is_len_var and f.lenvar_for.is_tlv and f.lenvar_for.name == tlv_name][0]
|
||||||
|
|
||||||
def print_towire(self, is_header, tlv_name):
|
def print_towire(self, is_header):
|
||||||
template = towire_header_templ if is_header else towire_impl_templ
|
template = towire_header_templ if is_header else towire_impl_templ
|
||||||
args = []
|
args = []
|
||||||
for f in self.fields:
|
for f in self.fields:
|
||||||
|
@ -751,9 +751,9 @@ struct {struct_name} {{
|
||||||
fields=str(fmt_fields))
|
fields=str(fmt_fields))
|
||||||
|
|
||||||
def print_towire(self, is_header, tlv_name):
|
def print_towire(self, is_header, tlv_name):
|
||||||
|
""" prints towire function definition for a TLV message."""
|
||||||
if is_header:
|
if is_header:
|
||||||
return ''
|
return ''
|
||||||
""" prints towire function definition for a TLV message."""
|
|
||||||
field_decls = []
|
field_decls = []
|
||||||
for f in self.fields:
|
for f in self.fields:
|
||||||
if f.is_tlv:
|
if f.is_tlv:
|
||||||
|
@ -1346,8 +1346,8 @@ else:
|
||||||
towire_decls += build_tlv_towires(tlv_fields)
|
towire_decls += build_tlv_towires(tlv_fields)
|
||||||
fromwire_decls += build_tlv_fromwires(tlv_fields)
|
fromwire_decls += build_tlv_fromwires(tlv_fields)
|
||||||
|
|
||||||
towire_decls += [m.print_towire(options.header, '') for m in toplevel_messages + messages_with_option]
|
towire_decls += [m.print_towire(options.header) for m in toplevel_messages + messages_with_option]
|
||||||
fromwire_decls += [m.print_fromwire(options.header, '') for m in toplevel_messages + messages_with_option]
|
fromwire_decls += [m.print_fromwire(options.header) for m in toplevel_messages + messages_with_option]
|
||||||
decls = fromwire_decls + towire_decls
|
decls = fromwire_decls + towire_decls
|
||||||
|
|
||||||
print(template.format(
|
print(template.format(
|
||||||
|
|
Loading…
Add table
Reference in a new issue