diff --git a/contrib/pyln-proto/pyln/proto/message/message.py b/contrib/pyln-proto/pyln/proto/message/message.py index 33b879c9b76e..31a1511bafe2 100644 --- a/contrib/pyln-proto/pyln/proto/message/message.py +++ b/contrib/pyln-proto/pyln/proto/message/message.py @@ -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 != '':