Skip to content

Commit 2d73c08

Browse files
committed
fix Update fields in new ChannelTransactionParameters
1 parent 7ef4ffd commit 2d73c08

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lightning/src/ln/channel.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9237,11 +9237,13 @@ impl<SP: Deref> FundedChannel<SP> where
92379237

92389238
/// Helper to build the FundingScope for the splicing channel
92399239
#[cfg(splicing)]
9240-
fn funding_scope_for_splice(&self, our_funding_satoshis: u64, post_channel_value: u64) -> FundingScope {
9240+
fn funding_scope_for_splice(&self, our_funding_satoshis: u64, post_channel_value: u64, is_outbound: bool, counterparty_funding_pubkey: PublicKey) -> FundingScope {
92419241
let post_value_to_self_msat = self.funding.value_to_self_msat.saturating_add(our_funding_satoshis);
92429242

92439243
let mut post_channel_transaction_parameters = self.funding.channel_transaction_parameters.clone();
9244+
// Updated fields:
92449245
post_channel_transaction_parameters.channel_value_satoshis = post_channel_value;
9246+
post_channel_transaction_parameters.is_outbound_from_holder = is_outbound;
92459247
// Update the splicing 'tweak', this will rotate the keys in the signer
92469248
let prev_funding_txid = self.funding.channel_transaction_parameters.funding_outpoint
92479249
.map(|outpoint| outpoint.txid);
@@ -9255,6 +9257,10 @@ impl<SP: Deref> FundedChannel<SP> where
92559257
#[cfg(taproot)]
92569258
_ => todo!()
92579259
}
9260+
post_channel_transaction_parameters.funding_outpoint = None; // filled later
9261+
if let Some(ref mut counterparty_parameters) = post_channel_transaction_parameters.counterparty_parameters {
9262+
counterparty_parameters.pubkeys.funding_pubkey = counterparty_funding_pubkey;
9263+
}
92589264

92599265
// New reserve values are based on the new channel value, and v2-specific
92609266
let counterparty_selected_channel_reserve_satoshis = Some(get_v2_channel_reserve_satoshis(
@@ -9300,7 +9306,7 @@ impl<SP: Deref> FundedChannel<SP> where
93009306
false, // is_outbound
93019307
)?;
93029308

9303-
let funding_scope = self.funding_scope_for_splice(our_funding_satoshis, post_channel_value);
9309+
let funding_scope = self.funding_scope_for_splice(our_funding_satoshis, post_channel_value, false, msg.funding_pubkey);
93049310

93059311
let funding_negotiation_context = FundingNegotiationContext {
93069312
our_funding_satoshis,
@@ -9318,7 +9324,6 @@ impl<SP: Deref> FundedChannel<SP> where
93189324
interactive_tx_constructor: None,
93199325
interactive_tx_signing_session: None,
93209326
});
9321-
// TODO(splicing): Store msg.funding_pubkey
93229327

93239328
// Apply start of splice change in the state
93249329
self.splice_start(false, logger);
@@ -9382,7 +9387,7 @@ impl<SP: Deref> FundedChannel<SP> where
93829387
true, // is_outbound
93839388
)?;
93849389

9385-
let funding_scope = self.funding_scope_for_splice(our_funding_satoshis, post_channel_value);
9390+
let funding_scope = self.funding_scope_for_splice(our_funding_satoshis, post_channel_value, true, msg.funding_pubkey);
93869391

93879392
let pre_funding_transaction = &self.funding.funding_transaction;
93889393
let pre_funding_txo = &self.funding.get_funding_txo();

0 commit comments

Comments
 (0)