Skip to content

Commit

Permalink
pyln.proto: fix receiving unknown fields in TLVs.
Browse files Browse the repository at this point in the history
We can still convert these (e.g. k=1) to Python, by just using hex strings.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jun 24, 2021
1 parent ca36802 commit edee079
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contrib/pyln-proto/pyln/proto/message/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,12 @@ def val_to_py(self, val: Dict[str, Any], otherfields: Dict[str, Any]) -> Dict[st
ret: Dict[str, Any] = {}
for k, v in val.items():
field = self.find_field(k)
assert field
ret[k] = field.val_to_py(v, val)
if field:
ret[k] = field.val_to_py(v, val)
else:
# Unknown TLV, index by number.
assert isinstance(k, int)
ret[k] = v.hex()
return ret

def write(self, io_out: BufferedIOBase, v: Optional[Dict[str, Any]], otherfields: Dict[str, Any]) -> None:
Expand Down

0 comments on commit edee079

Please sign in to comment.