@@ -1961,9 +1961,6 @@ impl FundingScope {
19611961struct PendingSplice {
19621962 /// Intended contributions to the splice from our end
19631963 pub our_funding_contribution: i64,
1964- /// Set when splice_ack has been processed (on the initiator side),
1965- /// used to prevent processing of multiple splice_ack's.
1966- awaiting_splice_ack: bool,
19671964 funding_scope: Option<FundingScope>,
19681965 funding_negotiation_context: FundingNegotiationContext,
19691966 /// The current interactive transaction construction session under negotiation.
@@ -9063,7 +9060,6 @@ impl<SP: Deref> FundedChannel<SP> where
90639060 };
90649061 self.pending_splice = Some(PendingSplice {
90659062 our_funding_contribution: our_funding_contribution_satoshis,
9066- awaiting_splice_ack: true, // we await splice_ack
90679063 funding_scope: None,
90689064 funding_negotiation_context,
90699065 interactive_tx_constructor: None,
@@ -9099,6 +9095,8 @@ impl<SP: Deref> FundedChannel<SP> where
90999095 // TODO(splicing): Currently not possible to contribute on the splicing-acceptor side
91009096 let our_funding_contribution_satoshis = 0i64;
91019097
9098+ // TODO(splicing): Add check that we are the quiescence acceptor
9099+
91029100 // Check if a splice has been initiated already.
91039101 if let Some(pending_splice) = &self.pending_splice {
91049102 return Err(ChannelError::Warn(format!(
@@ -9224,7 +9222,6 @@ impl<SP: Deref> FundedChannel<SP> where
92249222
92259223 self.pending_splice = Some(PendingSplice {
92269224 our_funding_contribution,
9227- awaiting_splice_ack: false, // we don't need any additional message for the handshake
92289225 funding_scope: Some(funding_scope),
92299226 funding_negotiation_context,
92309227 interactive_tx_constructor: None,
@@ -9283,8 +9280,10 @@ impl<SP: Deref> FundedChannel<SP> where
92839280 return Err(ChannelError::Warn(format!("Channel is not in pending splice")));
92849281 };
92859282
9286- if !pending_splice.awaiting_splice_ack {
9287- return Err(ChannelError::Warn(format!("Received unexpected splice_ack")));
9283+ // TODO(splicing): Add check that we are the splice (quiescence) initiator
9284+
9285+ if pending_splice.funding_scope.is_some() || pending_splice.interactive_tx_constructor.is_some() {
9286+ return Err(ChannelError::Warn(format!("Got unexpected splice_ack, splice already negotiating")));
92889287 }
92899288
92909289 let our_funding_contribution = pending_splice.our_funding_contribution;
@@ -9313,14 +9312,13 @@ impl<SP: Deref> FundedChannel<SP> where
93139312 // We need the current funding tx as an extra input
93149313 let prev_funding_input = Self::get_input_of_previous_funding(pre_funding_transaction, pre_funding_txo)?;
93159314 let pending_splice_mut = self.pending_splice.as_mut().unwrap(); // existence checked above
9315+ debug_assert!(pending_splice_mut.funding_scope.is_none());
93169316 pending_splice_mut.funding_scope = Some(funding_scope);
93179317 // update funding values
93189318 pending_splice_mut.funding_negotiation_context.our_funding_satoshis = our_funding_satoshis;
93199319 pending_splice_mut.funding_negotiation_context.their_funding_satoshis = Some(their_funding_satoshis);
93209320 pending_splice_mut.interactive_tx_constructor = None;
93219321 pending_splice_mut.interactive_tx_signing_session = None;
9322- debug_assert!(pending_splice_mut.awaiting_splice_ack);
9323- pending_splice_mut.awaiting_splice_ack = false;
93249322
93259323 log_info!(logger, "Splicing process started after splice_ack, new channel value {}, old {}, outgoing {}, channel_id {}",
93269324 post_channel_value, pre_channel_value, true, self.context.channel_id);
0 commit comments