Skip to content

Commit 1bb3b4d

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 1bb3b4d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lightning/src/ln/channel.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10747,7 +10747,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1074710747
_ => return Err(DecodeError::InvalidValue),
1074810748
};
1074910749

10750-
let mut channel_parameters: ChannelTransactionParameters = ReadableArgs::<u64>::read(reader, channel_value_satoshis)?;
10750+
let channel_parameters: ChannelTransactionParameters = ReadableArgs::<u64>::read(reader, channel_value_satoshis)?;
1075110751
let funding_transaction: Option<Transaction> = Readable::read(reader)?;
1075210752

1075310753
let counterparty_cur_commitment_point = Readable::read(reader)?;
@@ -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());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## API Updates (0.2)
2+
3+
* Upgrading to v0.2.0 from a version prior to 0.0.116 is not allowed when a channel was opened with
4+
either `scid_privacy` or `zero_conf` included in its channel type. Upgrade to v0.0.116 first
5+
before upgrading to v0.2.0.

0 commit comments

Comments
 (0)