Skip to content

Commit

Permalink
pyln.proto.message: don't let Message() init set implicit lengths.
Browse files Browse the repository at this point in the history
We'll override them from field length anyway!

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Aug 6, 2020
1 parent 4fde456 commit 06372e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/pyln-proto/pyln/proto/message/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,8 @@ def set_field(self, field: str, val: Any) -> None:
f = self.messagetype.find_field(field)
if f is None:
raise ValueError("Unknown field {}".format(field))

if isinstance(f.fieldtype, LengthFieldType):
raise ValueError("Cannot specify implied length field {}".format(field))
if isinstance(val, str):
val, remainder = f.fieldtype.val_from_str(val)
if remainder != '':
Expand Down

0 comments on commit 06372e1

Please sign in to comment.