bolt-gen: make needs-context not recursive

originally done so that any field within a subtype needed context,
that would be reflected at the top-most layer. in reality, we
allocate subtype fields off of the instance of the subtype, so
there's no need to check beneath the 'top' layer of field/types
in a message to determine whether or not to pass in a context.
This commit is contained in:
lisa neigut
2019-07-23 16:00:06 -05:00
committed by Rusty Russell
parent b30d7d26ea
commit 40154b35f0

View File

@@ -87,8 +87,7 @@ class Field(object):
return self.len_field
def needs_context(self):
""" A field needs a context if its type needs context
or if it's varsized """
""" A field needs a context if it's varsized """
return self.is_varlen() or self.type_obj.needs_context()
def arg_desc_to(self):
@@ -286,7 +285,7 @@ class Type(FieldSet):
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()])
return self.is_varsize()
def is_assignable(self):
""" Generally typedef's and enums """