Skip to content

Commit b5a46c7

Browse files
committed
fix Don’t track is_splice, rely on splice_parent_funding_txid
1 parent 44d3e13 commit b5a46c7

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
@@ -2885,13 +2885,16 @@ where
28852885
interactive_tx_constructor: &'a mut Option<InteractiveTxConstructor>,
28862886
interactive_tx_signing_session: &'a mut Option<InteractiveTxSigningSession>,
28872887
holder_commitment_transaction_number: u64,
2888-
is_splice: bool,
28892888
}
28902889

28912890
impl<'a, SP: Deref> NegotiatingChannelView<'a, SP>
28922891
where
28932892
SP::Target: SignerProvider,
28942893
{
2894+
fn is_splice(&self) -> bool {
2895+
self.funding.channel_transaction_parameters.splice_parent_funding_txid.is_some()
2896+
}
2897+
28952898
/// Prepare and start interactive transaction negotiation.
28962899
/// `change_destination_opt` - Optional destination for optional change; if None,
28972900
/// default destination address is used.
@@ -2905,7 +2908,7 @@ where
29052908
where
29062909
ES::Target: EntropySource,
29072910
{
2908-
if self.is_splice {
2911+
if self.is_splice() {
29092912
debug_assert!(matches!(self.context.channel_state, ChannelState::ChannelReady(_)));
29102913
} else {
29112914
debug_assert!(matches!(
@@ -3114,7 +3117,7 @@ where
31143117
self.funding
31153118
.channel_transaction_parameters.funding_outpoint = Some(outpoint);
31163119

3117-
if self.is_splice {
3120+
if self.is_splice() {
31183121
// TODO(splicing) Forced error, as the use case is not complete
31193122
return Err(ChannelError::Close((
31203123
"TODO Forced error, incomplete implementation".into(),
@@ -6241,7 +6244,6 @@ where
62416244
holder_commitment_transaction_number: self
62426245
.holder_commitment_point
62436246
.transaction_number(),
6244-
is_splice: true,
62456247
})
62466248
} else {
62476249
Err("Received unexpected interactive transaction negotiation message: \
@@ -10650,7 +10652,6 @@ where
1065010652
interactive_tx_constructor: &mut pending_splice_mut.interactive_tx_constructor,
1065110653
interactive_tx_signing_session: &mut pending_splice_mut.interactive_tx_signing_session,
1065210654
holder_commitment_transaction_number: self.holder_commitment_point.transaction_number(),
10653-
is_splice: true,
1065410655
};
1065510656

1065610657
// Start interactive funding negotiation. TODO(splicing): Add current funding as extra input, once shared inputs are supported, see #3842.
@@ -10772,7 +10773,6 @@ where
1077210773
interactive_tx_constructor: &mut pending_splice.interactive_tx_constructor,
1077310774
interactive_tx_signing_session: &mut pending_splice.interactive_tx_signing_session,
1077410775
holder_commitment_transaction_number: self.holder_commitment_point.transaction_number(),
10775-
is_splice: true,
1077610776
};
1077710777

1077810778
// Start interactive funding negotiation, with the previous funding transaction as an extra shared input
@@ -12660,7 +12660,6 @@ where
1266012660
interactive_tx_constructor: &mut self.interactive_tx_constructor,
1266112661
interactive_tx_signing_session: &mut self.interactive_tx_signing_session,
1266212662
holder_commitment_transaction_number: self.unfunded_context.transaction_number(),
12663-
is_splice: false,
1266412663
}
1266512664
}
1266612665
}

0 commit comments

Comments
 (0)