@@ -1712,7 +1712,7 @@ where
17121712 if matches!(chan.context.channel_state, ChannelState::ChannelReady(_)) {
17131713 chan.context.channel_state.clear_local_stfu_sent();
17141714 chan.context.channel_state.clear_remote_stfu_sent();
1715- if chan.should_reset_pending_splice_state(false ) {
1715+ if chan.should_reset_pending_splice_state(true ) {
17161716 // If there was a pending splice negotiation that failed due to disconnecting, we
17171717 // also take the opportunity to clean up our state.
17181718 let splice_funding_failed = chan.reset_pending_splice_state();
@@ -1828,7 +1828,7 @@ where
18281828 (None, false)
18291829 },
18301830 ChannelPhase::Funded(funded_channel) => {
1831- if funded_channel.should_reset_pending_splice_state(false ) {
1831+ if funded_channel.should_reset_pending_splice_state(true ) {
18321832 (funded_channel.reset_pending_splice_state(), true)
18331833 } else {
18341834 debug_assert!(false, "We should never fail an interactive funding negotiation once we're exchanging tx_signatures");
@@ -2020,7 +2020,7 @@ where
20202020 "Received tx_abort while awaiting tx_signatures exchange".to_owned(),
20212021 ));
20222022 }
2023- if funded_channel.should_reset_pending_splice_state(true ) {
2023+ if funded_channel.should_reset_pending_splice_state(false ) {
20242024 let has_funding_negotiation = funded_channel
20252025 .pending_splice
20262026 .as_ref()
@@ -7156,7 +7156,7 @@ where
71567156
71577157 fn maybe_fail_splice_negotiation(&mut self) -> Option<SpliceFundingFailed> {
71587158 if matches!(self.context.channel_state, ChannelState::ChannelReady(_)) {
7159- if self.should_reset_pending_splice_state(false ) {
7159+ if self.should_reset_pending_splice_state(true ) {
71607160 self.reset_pending_splice_state()
71617161 } else {
71627162 self.abandon_quiescent_action()
@@ -7213,7 +7213,7 @@ where
72137213
72147214 /// Returns a boolean indicating whether we should reset the splice's
72157215 /// [`PendingFunding::funding_negotiation`].
7216- fn should_reset_pending_splice_state(&self, counterparty_aborted : bool) -> bool {
7216+ fn should_reset_pending_splice_state(&self, allow_resumption : bool) -> bool {
72177217 self.pending_splice
72187218 .as_ref()
72197219 .map(|pending_splice| {
@@ -7225,16 +7225,18 @@ where
72257225 funding_negotiation,
72267226 FundingNegotiation::AwaitingSignatures { .. }
72277227 );
7228- if counterparty_aborted {
7228+ if allow_resumption {
7229+ // If we want to resume the negotiation after reconnecting, we must be
7230+ // in [`FundingNegotiation::AwaitingSignatures`] to not reset our state.
7231+ !is_awaiting_signatures
7232+ } else {
72297233 !is_awaiting_signatures
72307234 || !self
72317235 .context()
72327236 .interactive_tx_signing_session
72337237 .as_ref()
72347238 .expect("We have a pending splice awaiting signatures")
72357239 .has_received_commitment_signed()
7236- } else {
7237- !is_awaiting_signatures
72387240 }
72397241 })
72407242 .unwrap_or_else(|| {
@@ -7248,7 +7250,7 @@ where
72487250 }
72497251
72507252 fn reset_pending_splice_state(&mut self) -> Option<SpliceFundingFailed> {
7251- debug_assert!(self.should_reset_pending_splice_state(true ));
7253+ debug_assert!(self.should_reset_pending_splice_state(false ));
72527254
72537255 // Only clear the signing session if the current round is mid-signing. When an earlier
72547256 // round completed signing and a later RBF round is in AwaitingAck or
@@ -7308,7 +7310,7 @@ where
73087310 }
73097311
73107312 pub(super) fn maybe_splice_funding_failed(&self) -> Option<SpliceFundingFailed> {
7311- if !self.should_reset_pending_splice_state(false ) {
7313+ if !self.should_reset_pending_splice_state(true ) {
73127314 return None;
73137315 }
73147316
@@ -15423,7 +15425,7 @@ impl<SP: SignerProvider> Writeable for FundedChannel<SP> {
1542315425 ChannelState::ChannelReady(_) => {
1542415426 channel_state.clear_local_stfu_sent();
1542515427 channel_state.clear_remote_stfu_sent();
15426- if self.should_reset_pending_splice_state(false )
15428+ if self.should_reset_pending_splice_state(true )
1542715429 || !self.has_pending_splice_awaiting_signatures()
1542815430 {
1542915431 // We shouldn't be quiescent anymore upon reconnecting if:
@@ -15813,7 +15815,7 @@ impl<SP: SignerProvider> Writeable for FundedChannel<SP> {
1581315815 // We don't have to worry about resetting the pending `FundingNegotiation` because we
1581415816 // can only read `FundingNegotiation::AwaitingSignatures` variants anyway.
1581515817 let pending_splice =
15816- self.pending_splice.as_ref().filter(|_| !self.should_reset_pending_splice_state(false ));
15818+ self.pending_splice.as_ref().filter(|_| !self.should_reset_pending_splice_state(true ));
1581715819
1581815820 let monitor_pending_tx_signatures =
1581915821 self.context.monitor_pending_tx_signatures.then_some(());
0 commit comments