Skip to content

Commit 80ec785

Browse files
committed
Sync ChannelTransactionParameters features to ChannelContext.
1 parent 717c033 commit 80ec785

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
@@ -5748,6 +5748,7 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
57485748
} else {
57495749
self.context.channel_type = ChannelTypeFeatures::only_static_remote_key();
57505750
}
5751+
self.context.channel_transaction_parameters.channel_type_features = self.context.channel_type.clone();
57515752
Ok(self.get_open_channel(chain_hash))
57525753
}
57535754

@@ -5866,7 +5867,8 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
58665867
if channel_type != ChannelTypeFeatures::only_static_remote_key() {
58675868
return Err(ChannelError::Close("Only static_remote_key is supported for non-negotiated channel types".to_owned()));
58685869
}
5869-
self.context.channel_type = channel_type;
5870+
self.context.channel_type = channel_type.clone();
5871+
self.context.channel_transaction_parameters.channel_type_features = channel_type;
58705872
}
58715873

58725874
let counterparty_shutdown_scriptpubkey = if their_features.supports_upfront_shutdown_script() {
@@ -7039,7 +7041,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
70397041
_ => return Err(DecodeError::InvalidValue),
70407042
};
70417043

7042-
let channel_parameters: ChannelTransactionParameters = Readable::read(reader)?;
7044+
let mut channel_parameters: ChannelTransactionParameters = Readable::read(reader)?;
70437045
let funding_transaction = Readable::read(reader)?;
70447046

70457047
let counterparty_cur_commitment_point = Readable::read(reader)?;
@@ -7165,6 +7167,10 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
71657167
return Err(DecodeError::UnknownRequiredFeature);
71667168
}
71677169

7170+
// ChannelTransactionParameters may have had an empty features set upon deserialization.
7171+
// To account for that, we're proactively setting/overriding the field here.
7172+
channel_parameters.channel_type_features = chan_features.clone();
7173+
71687174
let mut secp_ctx = Secp256k1::new();
71697175
secp_ctx.seeded_randomize(&entropy_source.get_secure_random_bytes());
71707176

0 commit comments

Comments
 (0)