Skip to content

Commit 025d49d

Browse files
committed
Wipe quiescence flag on tx_abort for funded channels
`tx_abort` also serves as a terminal message for a splice within the quiescence protocol, just as `tx_signatures` or a disconnection would. This ensures we are able to resume the channel without needing to reconnect.
1 parent 3e21ba3 commit 025d49d

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

lightning/src/ln/channel.rs

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,27 +1686,19 @@ where
16861686
let logger = WithChannelContext::from(logger, &self.context(), None);
16871687
log_info!(logger, "Failed interactive transaction negotiation: {reason}");
16881688

1689-
let _interactive_tx_constructor = match &mut self.phase {
1689+
match &mut self.phase {
16901690
ChannelPhase::Undefined => unreachable!(),
1691-
ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => None,
1691+
ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => {},
16921692
ChannelPhase::UnfundedV2(pending_v2_channel) => {
1693-
pending_v2_channel.interactive_tx_constructor.take()
1693+
pending_v2_channel.interactive_tx_constructor.take();
1694+
},
1695+
ChannelPhase::Funded(funded_channel) => {
1696+
funded_channel.context.channel_state.clear_quiescent();
1697+
funded_channel
1698+
.pending_splice
1699+
.as_mut()
1700+
.and_then(|pending_splice| pending_splice.funding_negotiation.take());
16941701
},
1695-
ChannelPhase::Funded(funded_channel) => funded_channel
1696-
.pending_splice
1697-
.as_mut()
1698-
.and_then(|pending_splice| pending_splice.funding_negotiation.take())
1699-
.and_then(|funding_negotiation| {
1700-
if let FundingNegotiation::ConstructingTransaction {
1701-
interactive_tx_constructor,
1702-
..
1703-
} = funding_negotiation
1704-
{
1705-
Some(interactive_tx_constructor)
1706-
} else {
1707-
None
1708-
}
1709-
}),
17101702
};
17111703

17121704
reason.into_tx_abort_msg(self.context().channel_id)
@@ -1832,11 +1824,14 @@ where
18321824
ChannelPhase::UnfundedV2(pending_v2_channel) => {
18331825
pending_v2_channel.interactive_tx_constructor.take().is_some()
18341826
},
1835-
ChannelPhase::Funded(funded_channel) => funded_channel
1836-
.pending_splice
1837-
.as_mut()
1838-
.and_then(|pending_splice| pending_splice.funding_negotiation.take())
1839-
.is_some(),
1827+
ChannelPhase::Funded(funded_channel) => {
1828+
funded_channel.context.channel_state.clear_quiescent();
1829+
funded_channel
1830+
.pending_splice
1831+
.as_mut()
1832+
.and_then(|pending_splice| pending_splice.funding_negotiation.take())
1833+
.is_some()
1834+
},
18401835
};
18411836

18421837
// NOTE: Since at this point we have not sent a `tx_abort` message for this negotiation

0 commit comments

Comments
 (0)