@@ -2728,10 +2728,6 @@ where
2728
2728
/// If we can't release a [`ChannelMonitorUpdate`] until some external action completes, we
2729
2729
/// store it here and only release it to the `ChannelManager` once it asks for it.
2730
2730
blocked_monitor_updates: Vec<PendingChannelMonitorUpdate>,
2731
-
2732
- /// Only set when a counterparty `stfu` has been processed to track which node is allowed to
2733
- /// propose "something fundamental" upon becoming quiescent.
2734
- is_holder_quiescence_initiator: Option<bool>,
2735
2731
}
2736
2732
2737
2733
/// A channel struct implementing this trait can receive an initial counterparty commitment
@@ -3306,8 +3302,6 @@ where
3306
3302
blocked_monitor_updates: Vec::new(),
3307
3303
3308
3304
is_manual_broadcast: false,
3309
-
3310
- is_holder_quiescence_initiator: None,
3311
3305
};
3312
3306
3313
3307
Ok((funding, channel_context))
@@ -3544,8 +3538,6 @@ where
3544
3538
blocked_monitor_updates: Vec::new(),
3545
3539
local_initiated_shutdown: None,
3546
3540
is_manual_broadcast: false,
3547
-
3548
- is_holder_quiescence_initiator: None,
3549
3541
};
3550
3542
3551
3543
Ok((funding, channel_context))
@@ -8202,7 +8194,6 @@ where
8202
8194
self.context.channel_state.clear_local_stfu_sent();
8203
8195
self.context.channel_state.clear_remote_stfu_sent();
8204
8196
self.context.channel_state.clear_quiescent();
8205
- self.context.is_holder_quiescence_initiator.take();
8206
8197
}
8207
8198
8208
8199
self.context.channel_state.set_peer_disconnected();
@@ -11591,18 +11582,10 @@ where
11591
11582
self.context.channel_state.clear_awaiting_quiescence();
11592
11583
self.context.channel_state.clear_remote_stfu_sent();
11593
11584
self.context.channel_state.set_quiescent();
11594
- if let Some(initiator) = self.context.is_holder_quiescence_initiator.as_ref() {
11595
- log_debug!(
11596
- logger,
11597
- "Responding to counterparty stfu with our own, channel is now quiescent and we are{} the initiator",
11598
- if !initiator { " not" } else { "" }
11599
- );
11600
-
11601
- *initiator
11602
- } else {
11603
- debug_assert!(false, "Quiescence initiator must have been set when we received stfu");
11604
- false
11605
- }
11585
+ // We are sending an stfu in response to our couterparty's stfu, but had not yet sent
11586
+ // our own stfu (even if `awaiting_quiescence` was set). Thus, the counterparty is the
11587
+ // initiator and they can do "something fundamental".
11588
+ false
11606
11589
} else {
11607
11590
log_debug!(logger, "Sending stfu as quiescence initiator");
11608
11591
debug_assert!(self.context.channel_state.is_awaiting_quiescence());
@@ -11633,9 +11616,7 @@ where
11633
11616
));
11634
11617
}
11635
11618
11636
- if self.context.channel_state.is_awaiting_quiescence()
11637
- || !self.context.channel_state.is_local_stfu_sent()
11638
- {
11619
+ if !self.context.channel_state.is_local_stfu_sent() {
11639
11620
if !msg.initiator {
11640
11621
return Err(ChannelError::WarnAndDisconnect(
11641
11622
"Peer sent unexpected `stfu` without signaling as initiator".to_owned()
@@ -11649,23 +11630,13 @@ where
11649
11630
// then.
11650
11631
self.context.channel_state.set_remote_stfu_sent();
11651
11632
11652
- let is_holder_initiator = if self.context.channel_state.is_awaiting_quiescence() {
11653
- // We were also planning to propose quiescence, let the tie-breaker decide the
11654
- // initiator.
11655
- self.funding.is_outbound()
11656
- } else {
11657
- false
11658
- };
11659
- self.context.is_holder_quiescence_initiator = Some(is_holder_initiator);
11660
-
11661
11633
log_debug!(logger, "Received counterparty stfu proposing quiescence");
11662
11634
return self.send_stfu(logger).map(|stfu| Some(stfu));
11663
11635
}
11664
11636
11665
11637
// We already sent `stfu` and are now processing theirs. It may be in response to ours, or
11666
11638
// we happened to both send `stfu` at the same time and a tie-break is needed.
11667
11639
let is_holder_quiescence_initiator = !msg.initiator || self.funding.is_outbound();
11668
- self.context.is_holder_quiescence_initiator = Some(is_holder_quiescence_initiator);
11669
11640
11670
11641
// We were expecting to receive `stfu` because we already sent ours.
11671
11642
self.mark_response_received();
@@ -11733,13 +11704,10 @@ where
11733
11704
debug_assert!(!self.context.channel_state.is_local_stfu_sent());
11734
11705
debug_assert!(!self.context.channel_state.is_remote_stfu_sent());
11735
11706
11736
- if self.context.channel_state.is_quiescent() {
11737
- self.mark_response_received();
11738
- self.context.channel_state.clear_quiescent();
11739
- self.context.is_holder_quiescence_initiator.take().expect("Must always be set while quiescent")
11740
- } else {
11741
- false
11742
- }
11707
+ self.mark_response_received();
11708
+ let was_quiescent = self.context.channel_state.is_quiescent();
11709
+ self.context.channel_state.clear_quiescent();
11710
+ was_quiescent
11743
11711
}
11744
11712
11745
11713
pub fn remove_legacy_scids_before_block(&mut self, height: u32) -> alloc::vec::Drain<'_, u64> {
@@ -14001,8 +13969,6 @@ where
14001
13969
14002
13970
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
14003
13971
is_manual_broadcast: is_manual_broadcast.unwrap_or(false),
14004
-
14005
- is_holder_quiescence_initiator: None,
14006
13972
},
14007
13973
interactive_tx_signing_session,
14008
13974
holder_commitment_point,
0 commit comments