mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 16:14:23 +01:00
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:
committed by
Rusty Russell
parent
b30d7d26ea
commit
40154b35f0
@@ -87,8 +87,7 @@ class Field(object):
|
|||||||
return self.len_field
|
return self.len_field
|
||||||
|
|
||||||
def needs_context(self):
|
def needs_context(self):
|
||||||
""" A field needs a context if its type needs context
|
""" A field needs a context if it's varsized """
|
||||||
or if it's varsized """
|
|
||||||
return self.is_varlen() or self.type_obj.needs_context()
|
return self.is_varlen() or self.type_obj.needs_context()
|
||||||
|
|
||||||
def arg_desc_to(self):
|
def arg_desc_to(self):
|
||||||
@@ -286,7 +285,7 @@ class Type(FieldSet):
|
|||||||
return self.name in self.truncated_typedefs
|
return self.name in self.truncated_typedefs
|
||||||
|
|
||||||
def needs_context(self):
|
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):
|
def is_assignable(self):
|
||||||
""" Generally typedef's and enums """
|
""" Generally typedef's and enums """
|
||||||
|
|||||||
Reference in New Issue
Block a user