Skip to content

Commit c40d1e8

Browse files
committed
Update OnchainTxHandler channel parameters on renegotiated funding locked
The `ChannelMonitor` now tracks its own set of channel parameters, but in the event they change after a splice, we want to ensure they are updated accordingly at the `OnchainTxHandler` level as well in case the user downgrades after a locked splice has already occurred.
1 parent 3023e2f commit c40d1e8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4049,6 +4049,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
40494049

40504050
mem::swap(&mut self.funding, &mut new_funding);
40514051
self.onchain_tx_handler.update_after_renegotiated_funding_locked(
4052+
self.funding.channel_parameters.clone(),
40524053
self.funding.current_holder_commitment_tx.clone(),
40534054
self.funding.prev_holder_commitment_tx.clone(),
40544055
);

lightning/src/chain/onchaintx.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,11 +1236,14 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
12361236
self.prev_holder_commitment = Some(replace(&mut self.holder_commitment, tx));
12371237
}
12381238

1239-
/// Replaces the current/prev holder commitment transactions spending the currently confirmed
1240-
/// funding outpoint with those spending the new funding outpoint.
1239+
/// Replaces all the data pertaining to the currently locked funding transaction after a new
1240+
/// funding transaction has been renegotiated and locked.
12411241
pub(crate) fn update_after_renegotiated_funding_locked(
1242-
&mut self, current: HolderCommitmentTransaction, prev: Option<HolderCommitmentTransaction>,
1242+
&mut self, channel_parameters: ChannelTransactionParameters,
1243+
current: HolderCommitmentTransaction, prev: Option<HolderCommitmentTransaction>,
12431244
) {
1245+
self.channel_value_satoshis = channel_parameters.channel_value_satoshis;
1246+
self.channel_transaction_parameters = channel_parameters;
12441247
self.holder_commitment = current;
12451248
self.prev_holder_commitment = prev;
12461249
}

0 commit comments

Comments
 (0)