diff --git a/common/initial_channel.c b/common/initial_channel.c index 8270f4a1bf16..fb01cd175e0a 100644 --- a/common/initial_channel.c +++ b/common/initial_channel.c @@ -201,6 +201,10 @@ struct channel_type **channel_upgradable_types(const tal_t *ctx, struct channel_type *channel_desired_type(const tal_t *ctx, const struct channel *channel) { + /* We don't actually want to downgrade anchors! */ + if (channel->option_anchor_outputs) + return type_anchor_outputs(ctx); + /* For now, we just want option_static_remotekey */ return type_static_remotekey(ctx); } diff --git a/contrib/pyln-proto/pyln/proto/message/message.py b/contrib/pyln-proto/pyln/proto/message/message.py index fea95cb5676f..eb3d7ec556e5 100644 --- a/contrib/pyln-proto/pyln/proto/message/message.py +++ b/contrib/pyln-proto/pyln/proto/message/message.py @@ -305,8 +305,8 @@ def write(self, io_out: BufferedIOBase, v: Dict[str, Any], otherfields: Dict[str 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]]: @@ -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: @@ -554,7 +558,7 @@ def get_value(tup): 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()) diff --git a/contrib/pyln-spec/bolt1/boltsetup.py b/contrib/pyln-spec/bolt1/boltsetup.py deleted file mode 120000 index 7a076c98151c..000000000000 --- a/contrib/pyln-spec/bolt1/boltsetup.py +++ /dev/null @@ -1 +0,0 @@ -../boltsetup.py \ No newline at end of file diff --git a/contrib/pyln-spec/bolt2/boltsetup.py b/contrib/pyln-spec/bolt2/boltsetup.py deleted file mode 120000 index 7a076c98151c..000000000000 --- a/contrib/pyln-spec/bolt2/boltsetup.py +++ /dev/null @@ -1 +0,0 @@ -../boltsetup.py \ No newline at end of file diff --git a/contrib/pyln-spec/bolt4/boltsetup.py b/contrib/pyln-spec/bolt4/boltsetup.py deleted file mode 120000 index 7a076c98151c..000000000000 --- a/contrib/pyln-spec/bolt4/boltsetup.py +++ /dev/null @@ -1 +0,0 @@ -../boltsetup.py \ No newline at end of file diff --git a/contrib/pyln-spec/bolt7/boltsetup.py b/contrib/pyln-spec/bolt7/boltsetup.py deleted file mode 120000 index 7a076c98151c..000000000000 --- a/contrib/pyln-spec/bolt7/boltsetup.py +++ /dev/null @@ -1 +0,0 @@ -../boltsetup.py \ No newline at end of file