@@ -2742,10 +2742,6 @@ where
2742
2742
/// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
2743
2743
/// store it here and only release it to the `ChannelManager` once it asks for it.
2744
2744
blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
2745
-
2746
- /// Only set when a counterparty `stfu` has been processed to track which node is allowed to
2747
- /// propose "something fundamental" upon becoming quiescent.
2748
- is_holder_quiescence_initiator: Option<bool>,
2749
2745
}
2750
2746
2751
2747
/// A channel struct implementing this trait can receive an initial counterparty commitment
@@ -3320,8 +3316,6 @@ where
3320
3316
blocked_monitor_updates: Vec::new(),
3321
3317
3322
3318
is_manual_broadcast: false,
3323
-
3324
- is_holder_quiescence_initiator: None,
3325
3319
};
3326
3320
3327
3321
Ok((funding, channel_context))
@@ -3558,8 +3552,6 @@ where
3558
3552
blocked_monitor_updates: Vec::new(),
3559
3553
local_initiated_shutdown: None,
3560
3554
is_manual_broadcast: false,
3561
-
3562
- is_holder_quiescence_initiator: None,
3563
3555
};
3564
3556
3565
3557
Ok((funding, channel_context))
@@ -8219,7 +8211,6 @@ where
8219
8211
self.context.channel_state.clear_local_stfu_sent();
8220
8212
self.context.channel_state.clear_remote_stfu_sent();
8221
8213
self.context.channel_state.clear_quiescent();
8222
- self.context.is_holder_quiescence_initiator.take();
8223
8214
}
8224
8215
8225
8216
self.context.channel_state.set_peer_disconnected();
@@ -11610,18 +11601,10 @@ where
11610
11601
self.context.channel_state.clear_awaiting_quiescence();
11611
11602
self.context.channel_state.clear_remote_stfu_sent();
11612
11603
self.context.channel_state.set_quiescent();
11613
- if let Some(initiator) = self.context.is_holder_quiescence_initiator.as_ref() {
11614
- log_debug!(
11615
- logger,
11616
- "Responding to counterparty stfu with our own, channel is now quiescent and we are{} the initiator",
11617
- if !initiator { " not" } else { "" }
11618
- );
11619
-
11620
- *initiator
11621
- } else {
11622
- debug_assert!(false, "Quiescence initiator must have been set when we received stfu");
11623
- false
11624
- }
11604
+ // We are sending an stfu in response to our couterparty's stfu, but had not yet sent
11605
+ // our own stfu (even if `awaiting_quiescence` was set). Thus, the counterparty is the
11606
+ // initiator and they can do "something fundamental".
11607
+ false
11625
11608
} else {
11626
11609
log_debug!(logger, "Sending stfu as quiescence initiator");
11627
11610
debug_assert!(self.context.channel_state.is_awaiting_quiescence());
@@ -11652,9 +11635,7 @@ where
11652
11635
));
11653
11636
}
11654
11637
11655
- if self.context.channel_state.is_awaiting_quiescence()
11656
- || !self.context.channel_state.is_local_stfu_sent()
11657
- {
11638
+ if !self.context.channel_state.is_local_stfu_sent() {
11658
11639
if !msg.initiator {
11659
11640
return Err(ChannelError::WarnAndDisconnect(
11660
11641
"Peer sent unexpected `stfu` without signaling as initiator".to_owned()
@@ -11668,23 +11649,13 @@ where
11668
11649
// then.
11669
11650
self.context.channel_state.set_remote_stfu_sent();
11670
11651
11671
- let is_holder_initiator = if self.context.channel_state.is_awaiting_quiescence() {
11672
- // We were also planning to propose quiescence, let the tie-breaker decide the
11673
- // initiator.
11674
- self.funding.is_outbound()
11675
- } else {
11676
- false
11677
- };
11678
- self.context.is_holder_quiescence_initiator = Some(is_holder_initiator);
11679
-
11680
11652
log_debug!(logger, "Received counterparty stfu proposing quiescence");
11681
11653
return self.send_stfu(logger).map(|stfu| Some(stfu));
11682
11654
}
11683
11655
11684
11656
// We already sent `stfu` and are now processing theirs. It may be in response to ours, or
11685
11657
// we happened to both send `stfu` at the same time and a tie-break is needed.
11686
11658
let is_holder_quiescence_initiator = !msg.initiator || self.funding.is_outbound();
11687
- self.context.is_holder_quiescence_initiator = Some(is_holder_quiescence_initiator);
11688
11659
11689
11660
// We were expecting to receive `stfu` because we already sent ours.
11690
11661
self.mark_response_received();
@@ -11752,13 +11723,10 @@ where
11752
11723
debug_assert!(!self.context.channel_state.is_local_stfu_sent());
11753
11724
debug_assert!(!self.context.channel_state.is_remote_stfu_sent());
11754
11725
11755
- if self.context.channel_state.is_quiescent() {
11756
- self.mark_response_received();
11757
- self.context.channel_state.clear_quiescent();
11758
- self.context.is_holder_quiescence_initiator.take().expect("Must always be set while quiescent")
11759
- } else {
11760
- false
11761
- }
11726
+ self.mark_response_received();
11727
+ let was_quiescent = self.context.channel_state.is_quiescent();
11728
+ self.context.channel_state.clear_quiescent();
11729
+ was_quiescent
11762
11730
}
11763
11731
11764
11732
pub fn remove_legacy_scids_before_block(&mut self, height: u32) -> alloc::vec::Drain<'_, u64> {
@@ -14018,8 +13986,6 @@ where
14018
13986
14019
13987
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
14020
13988
is_manual_broadcast: is_manual_broadcast.unwrap_or(false),
14021
-
14022
- is_holder_quiescence_initiator: None,
14023
13989
},
14024
13990
interactive_tx_signing_session,
14025
13991
holder_commitment_point,
0 commit comments