mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
pyln.proto: fix handling of subtypes in TLVs.
This was revealed by using lnprototest on channel_types. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
eaa2ff23f1
commit
ca3680246e
@ -305,8 +305,8 @@ other types. Since 'msgtype' is almost identical, it inherits from this too.
|
||||
raise ValueError("Missing field {} {}".format(f.name, otherfields))
|
||||
val = None
|
||||
|
||||
if self.name in otherfields:
|
||||
otherfields = otherfields[self.name]
|
||||
if type(f.fieldtype) is SubtypeType:
|
||||
otherfields = otherfields[f.name]
|
||||
f.fieldtype.write(io_out, val, otherfields)
|
||||
|
||||
def read(self, io_in: BufferedIOBase, otherfields: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
||||
@ -554,7 +554,7 @@ tlvdata,reply_channel_range_tlvs,timestamps_tlv,encoding_type,u8,
|
||||
|
||||
for typenum, writefunc, val in ordered:
|
||||
buf = BytesIO()
|
||||
writefunc(cast(BufferedIOBase, buf), val, otherfields)
|
||||
writefunc(cast(BufferedIOBase, buf), val, val)
|
||||
BigSizeType.write(io_out, typenum)
|
||||
BigSizeType.write(io_out, len(buf.getvalue()))
|
||||
io_out.write(buf.getvalue())
|
||||
|
Loading…
Reference in New Issue
Block a user