Skip to content

Commit

Permalink
tlv: remove requirement of having tlv_name
Browse files Browse the repository at this point in the history
  • Loading branch information
niftynei authored and rustyrussell committed Apr 10, 2019
1 parent de2fb7c commit 94395c6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/generate-wire.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def print_fromwire_array(self, ctx, subcalls, basetype, f, name, num_elems, is_t
subcalls.append('fromwire_{}({}cursor, {}plen, {} + i);'
.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 ''

args = []
Expand Down Expand Up @@ -530,7 +530,7 @@ def print_towire_array(self, subcalls, basetype, f, num_elems, is_tlv=False):
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]

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
args = []
for f in self.fields:
Expand Down Expand Up @@ -751,9 +751,9 @@ def _inner_print_struct(struct_name, fields):
fields=str(fmt_fields))

def print_towire(self, is_header, tlv_name):
""" prints towire function definition for a TLV message."""
if is_header:
return ''
""" prints towire function definition for a TLV message."""
field_decls = []
for f in self.fields:
if f.is_tlv:
Expand Down Expand Up @@ -1346,8 +1346,8 @@ def build_subtype_structs(subtypes):
towire_decls += build_tlv_towires(tlv_fields)
fromwire_decls += build_tlv_fromwires(tlv_fields)

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]
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]
decls = fromwire_decls + towire_decls

print(template.format(
Expand Down

0 comments on commit 94395c6

Please sign in to comment.