bolt-gen: fixup the devtool/decodemsg printing facility

Fixup TLV handling in the bolt printing utility, `devtools/decodemsg`
This commit is contained in:
lisa neigut
2019-07-20 22:04:59 -05:00
committed by Rusty Russell
parent cedebfd2d9
commit 281b4c241e
9 changed files with 160 additions and 43 deletions

View File

@@ -270,6 +270,9 @@ class Type(FieldSet):
def is_subtype(self):
return bool(self.fields)
def is_truncated(self):
return self.name in self.truncated_typedefs
def needs_context(self):
return self.is_varsize() or any([field.needs_context() for field in self.fields.values()])
@@ -329,6 +332,9 @@ class Tlv(object):
struct_prefix=self.struct_name(),
comments=comments)
def type_name(self):
return 'struct ' + self.struct_name()
def struct_name(self):
return "tlv_{}".format(self.name)