Skip to content

Commit fff7da5

Browse files
committed
Sync ChannelTransactionParameters features to ChannelContext.
1 parent 09f5e6b commit fff7da5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5744,6 +5744,7 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
57445744
} else {
57455745
self.context.channel_type = ChannelTypeFeatures::only_static_remote_key();
57465746
}
5747+
self.context.channel_transaction_parameters.channel_type_features = self.context.channel_type.clone();
57475748
Ok(self.get_open_channel(chain_hash))
57485749
}
57495750

@@ -5862,7 +5863,8 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
58625863
if channel_type != ChannelTypeFeatures::only_static_remote_key() {
58635864
return Err(ChannelError::Close("Only static_remote_key is supported for non-negotiated channel types".to_owned()));
58645865
}
5865-
self.context.channel_type = channel_type;
5866+
self.context.channel_type = channel_type.clone();
5867+
self.context.channel_transaction_parameters.channel_type_features = channel_type;
58665868
}
58675869

58685870
let counterparty_shutdown_scriptpubkey = if their_features.supports_upfront_shutdown_script() {
@@ -7035,7 +7037,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
70357037
_ => return Err(DecodeError::InvalidValue),
70367038
};
70377039

7038-
let channel_parameters: ChannelTransactionParameters = Readable::read(reader)?;
7040+
let mut channel_parameters: ChannelTransactionParameters = Readable::read(reader)?;
70397041
let funding_transaction = Readable::read(reader)?;
70407042

70417043
let counterparty_cur_commitment_point = Readable::read(reader)?;
@@ -7161,6 +7163,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
71617163
return Err(DecodeError::UnknownRequiredFeature);
71627164
}
71637165

7166+
// ChannelTransactionParameters may have had an empty features set upon deserialization.
7167+
// To account for that, we're proactively setting/overriding the field here.
7168+
channel_parameters.channel_type_features = chan_features.clone();
7169+
71647170
let mut secp_ctx = Secp256k1::new();
71657171
secp_ctx.seeded_randomize(&entropy_source.get_secure_random_bytes());
71667172

0 commit comments

Comments
 (0)