Skip to content

Commit f6e57d6

Browse files
committed
Remain quiescent on disconnect until tx_signatures exchange
As per the spec requirement, this was already enforced throughout the happy case when a disconnection does not happen. If a disconnect would happen, we always naively cleared the flag without checking whether we did indeed exchange `tx_signatures`.
1 parent 8c318ff commit f6e57d6

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8870,7 +8870,18 @@ where
88708870
}
88718871
self.context.channel_state.clear_local_stfu_sent();
88728872
self.context.channel_state.clear_remote_stfu_sent();
8873-
self.context.channel_state.clear_quiescent();
8873+
if self
8874+
.context
8875+
.interactive_tx_signing_session
8876+
.as_ref()
8877+
.map(|signing_session| {
8878+
signing_session.has_received_tx_signatures()
8879+
&& signing_session.holder_tx_signatures().is_some()
8880+
})
8881+
.unwrap_or(true)
8882+
{
8883+
self.context.channel_state.clear_quiescent();
8884+
}
88748885
}
88758886

88768887
self.context.channel_state.set_peer_disconnected();
@@ -11307,6 +11318,10 @@ where
1130711318
.as_ref()
1130811319
.filter(|session| !session.has_received_tx_signatures())
1130911320
.map(|signing_session| {
11321+
if self.pending_splice.is_some() {
11322+
debug_assert!(self.context.channel_state.is_quiescent());
11323+
}
11324+
1131011325
let mut next_funding = msgs::NextFunding {
1131111326
txid: signing_session.unsigned_tx().compute_txid(),
1131211327
retransmit_flags: 0,
@@ -13881,7 +13896,18 @@ where
1388113896
}
1388213897
channel_state.clear_local_stfu_sent();
1388313898
channel_state.clear_remote_stfu_sent();
13884-
channel_state.clear_quiescent();
13899+
if self
13900+
.context
13901+
.interactive_tx_signing_session
13902+
.as_ref()
13903+
.map(|signing_session| {
13904+
signing_session.has_received_tx_signatures()
13905+
&& signing_session.holder_tx_signatures().is_some()
13906+
})
13907+
.unwrap_or(true)
13908+
{
13909+
channel_state.clear_quiescent();
13910+
}
1388513911
},
1388613912
ChannelState::FundingNegotiated(_)
1388713913
if self.context.interactive_tx_signing_session.is_some() => {},

0 commit comments

Comments
 (0)