Skip to content

Commit cf63a79

Browse files
committed
fix Rotate signer keys when splicing
1 parent 37c7f43 commit cf63a79

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lightning/src/ln/channel.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -2432,7 +2432,7 @@ impl<SP: Deref> InitialRemoteCommitmentReceiver<SP> for FundedChannel<SP> where
24322432
}
24332433
}
24342434

2435-
/// A temporaty internal struct, used to return something from FundedChannel
2435+
/// A temporary internal struct, used to return something from FundedChannel
24362436
/// that implements [`FundingTxConstructorV2`], but only when it has the parts for it.
24372437
#[cfg(splicing)]
24382438
struct FundedChannelRefundingWrapper<'a, SP: Deref> where SP::Target: SignerProvider {
@@ -9088,8 +9088,14 @@ impl<SP: Deref> FundedChannel<SP> where
90889088
)?;
90899089

90909090
let post_value_to_self_msat = self.funding().value_to_self_msat.saturating_add(our_funding_satoshis);
9091+
90919092
let mut post_channel_transaction_parameters = self.funding().channel_transaction_parameters.clone();
90929093
post_channel_transaction_parameters.channel_value_satoshis = post_channel_value;
9094+
// Update the splicing 'tweak', this will rotate the keys in the signer
9095+
let prev_funding_txid = self.funding.funding_transaction.as_ref()
9096+
.map(|tx| tx.compute_txid());
9097+
post_channel_transaction_parameters.splice_parent_funding_txid = prev_funding_txid;
9098+
90939099
let pending_funding = FundingScope {
90949100
channel_transaction_parameters: post_channel_transaction_parameters,
90959101
value_to_self_msat: post_value_to_self_msat,
@@ -9198,8 +9204,14 @@ impl<SP: Deref> FundedChannel<SP> where
91989204
)?;
91999205

92009206
let post_value_to_self_msat = self.funding().value_to_self_msat.saturating_add(our_funding_satoshis);
9207+
92019208
let mut post_channel_transaction_parameters = self.funding().channel_transaction_parameters.clone();
92029209
post_channel_transaction_parameters.channel_value_satoshis = post_channel_value;
9210+
// Update the splicing 'tweak', this will rotate the keys in the signer
9211+
let prev_funding_txid = self.funding.funding_transaction.as_ref()
9212+
.map(|tx| tx.compute_txid());
9213+
post_channel_transaction_parameters.splice_parent_funding_txid = prev_funding_txid;
9214+
92039215
let pending_funding = FundingScope {
92049216
channel_transaction_parameters: post_channel_transaction_parameters,
92059217
value_to_self_msat: post_value_to_self_msat,

0 commit comments

Comments
 (0)