Skip to content

Commit 54ebb06

Browse files
committed
Check channel type features are consistent
When reading ChannelTransactionParameters, the channel_type_features defaults to only_static_remote_key. This is similarly the case for reading a channel. Instead of overriding the latter with the former, check that they are consistent. It doesn't appear that overriding was ever necessary.
1 parent b036a94 commit 54ebb06

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lightning/src/ln/channel.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10879,9 +10879,9 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1087910879
return Err(DecodeError::UnknownRequiredFeature);
1088010880
}
1088110881

10882-
// ChannelTransactionParameters may have had an empty features set upon deserialization.
10883-
// To account for that, we're proactively setting/overriding the field here.
10884-
channel_parameters.channel_type_features = chan_features;
10882+
if chan_features != channel_parameters.channel_type_features {
10883+
return Err(DecodeError::InvalidValue);
10884+
}
1088510885

1088610886
let mut secp_ctx = Secp256k1::new();
1088710887
secp_ctx.seeded_randomize(&entropy_source.get_secure_random_bytes());

0 commit comments

Comments
 (0)