Skip to content

Commit 586a094

Browse files
committed
fix Don’t track is_splice, rely on splice_parent_funding_txid
1 parent 21cb2b1 commit 586a094

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,13 +2858,16 @@ where
28582858
interactive_tx_constructor: &'a mut Option<InteractiveTxConstructor>,
28592859
interactive_tx_signing_session: &'a mut Option<InteractiveTxSigningSession>,
28602860
holder_commitment_transaction_number: u64,
2861-
is_splice: bool,
28622861
}
28632862

28642863
impl<'a, SP: Deref> NegotiatingChannelView<'a, SP>
28652864
where
28662865
SP::Target: SignerProvider,
28672866
{
2867+
fn is_splice(&self) -> bool {
2868+
self.funding.channel_transaction_parameters.splice_parent_funding_txid.is_some()
2869+
}
2870+
28682871
/// Prepare and start interactive transaction negotiation.
28692872
/// `change_destination_opt` - Optional destination for optional change; if None,
28702873
/// default destination address is used.
@@ -2878,7 +2881,7 @@ where
28782881
where
28792882
ES::Target: EntropySource,
28802883
{
2881-
if self.is_splice {
2884+
if self.is_splice() {
28822885
debug_assert!(matches!(self.context.channel_state, ChannelState::ChannelReady(_)));
28832886
} else {
28842887
debug_assert!(matches!(
@@ -3087,7 +3090,7 @@ where
30873090
self.funding
30883091
.channel_transaction_parameters.funding_outpoint = Some(outpoint);
30893092

3090-
if self.is_splice {
3093+
if self.is_splice() {
30913094
// TODO(splicing) Forced error, as the use case is not complete
30923095
return Err(ChannelError::Close((
30933096
"TODO Forced error, incomplete implementation".into(),
@@ -6207,7 +6210,6 @@ where
62076210
holder_commitment_transaction_number: self
62086211
.holder_commitment_point
62096212
.transaction_number(),
6210-
is_splice: true,
62116213
})
62126214
} else {
62136215
Err("Received unexpected interactive transaction negotiation message: \
@@ -10419,7 +10421,6 @@ where
1041910421
interactive_tx_constructor: &mut pending_splice_mut.interactive_tx_constructor,
1042010422
interactive_tx_signing_session: &mut pending_splice_mut.interactive_tx_signing_session,
1042110423
holder_commitment_transaction_number: self.holder_commitment_point.transaction_number(),
10422-
is_splice: true,
1042310424
};
1042410425

1042510426
// Start interactive funding negotiation. TODO(splicing): Add current funding as extra input, once shared inputs are supported, see #3842.
@@ -10541,7 +10542,6 @@ where
1054110542
interactive_tx_constructor: &mut pending_splice.interactive_tx_constructor,
1054210543
interactive_tx_signing_session: &mut pending_splice.interactive_tx_signing_session,
1054310544
holder_commitment_transaction_number: self.holder_commitment_point.transaction_number(),
10544-
is_splice: true,
1054510545
};
1054610546

1054710547
// Start interactive funding negotiation, with the previous funding transaction as an extra shared input
@@ -12429,7 +12429,6 @@ where
1242912429
interactive_tx_constructor: &mut self.interactive_tx_constructor,
1243012430
interactive_tx_signing_session: &mut self.interactive_tx_signing_session,
1243112431
holder_commitment_transaction_number: self.unfunded_context.transaction_number(),
12432-
is_splice: false,
1243312432
}
1243412433
}
1243512434
}

0 commit comments

Comments
 (0)