Skip to content

Commit d587412

Browse files
committed
fix Update fields in new ChannelTransactionParameters
1 parent 4f3c2e5 commit d587412

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
@@ -9241,11 +9241,13 @@ impl<SP: Deref> FundedChannel<SP> where
92419241

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

92479247
let mut post_channel_transaction_parameters = self.funding.channel_transaction_parameters.clone();
9248+
// Updated fields:
92489249
post_channel_transaction_parameters.channel_value_satoshis = post_channel_value;
9250+
post_channel_transaction_parameters.is_outbound_from_holder = is_outbound;
92499251
// Update the splicing 'tweak', this will rotate the keys in the signer
92509252
let prev_funding_txid = self.funding.channel_transaction_parameters.funding_outpoint
92519253
.map(|outpoint| outpoint.txid);
@@ -9259,6 +9261,10 @@ impl<SP: Deref> FundedChannel<SP> where
92599261
#[cfg(taproot)]
92609262
_ => todo!()
92619263
}
9264+
post_channel_transaction_parameters.funding_outpoint = None; // filled later
9265+
if let Some(ref mut counterparty_parameters) = post_channel_transaction_parameters.counterparty_parameters {
9266+
counterparty_parameters.pubkeys.funding_pubkey = counterparty_funding_pubkey;
9267+
}
92629268

92639269
// New reserve values are based on the new channel value, and v2-specific
92649270
let counterparty_selected_channel_reserve_satoshis = Some(get_v2_channel_reserve_satoshis(
@@ -9304,7 +9310,7 @@ impl<SP: Deref> FundedChannel<SP> where
93049310
false, // is_outbound
93059311
)?;
93069312

9307-
let funding_scope = self.funding_scope_for_splice(our_funding_satoshis, post_channel_value);
9313+
let funding_scope = self.funding_scope_for_splice(our_funding_satoshis, post_channel_value, false, msg.funding_pubkey);
93089314

93099315
let funding_negotiation_context = FundingNegotiationContext {
93109316
our_funding_satoshis,
@@ -9322,7 +9328,6 @@ impl<SP: Deref> FundedChannel<SP> where
93229328
interactive_tx_constructor: None,
93239329
interactive_tx_signing_session: None,
93249330
});
9325-
// TODO(splicing): Store msg.funding_pubkey
93269331

93279332
// Apply start of splice change in the state
93289333
self.splice_start(false, logger);
@@ -9386,7 +9391,7 @@ impl<SP: Deref> FundedChannel<SP> where
93869391
true, // is_outbound
93879392
)?;
93889393

9389-
let funding_scope = self.funding_scope_for_splice(our_funding_satoshis, post_channel_value);
9394+
let funding_scope = self.funding_scope_for_splice(our_funding_satoshis, post_channel_value, true, msg.funding_pubkey);
93909395

93919396
let pre_funding_transaction = &self.funding.funding_transaction;
93929397
let pre_funding_txo = &self.funding.get_funding_txo();

0 commit comments

Comments
 (0)