Skip to content

Commit 184d807

Browse files
committed
Rename should_force_holding_cell to can_generate_new_commitment
This better reflects the intent behind the callsites of the method.
1 parent f442ada commit 184d807

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ impl ChannelState {
560560
}
561561
}
562562

563-
fn should_force_holding_cell(&self) -> bool {
563+
fn can_generate_new_commitment(&self) -> bool {
564564
match self {
565565
ChannelState::ChannelReady(flags) =>
566566
flags.is_set(ChannelReadyFlags::AWAITING_REMOTE_REVOKE) ||
@@ -2709,7 +2709,7 @@ impl<SP: Deref> Channel<SP> where
27092709
where L::Target: Logger {
27102710
// Assert that we'll add the HTLC claim to the holding cell in `get_update_fulfill_htlc`
27112711
// (see equivalent if condition there).
2712-
assert!(self.context.channel_state.should_force_holding_cell());
2712+
assert!(self.context.channel_state.can_generate_new_commitment());
27132713
let mon_update_id = self.context.latest_monitor_update_id; // Forget the ChannelMonitor update
27142714
let fulfill_resp = self.get_update_fulfill_htlc(htlc_id_arg, payment_preimage_arg, logger);
27152715
self.context.latest_monitor_update_id = mon_update_id;
@@ -2778,7 +2778,7 @@ impl<SP: Deref> Channel<SP> where
27782778
}],
27792779
};
27802780

2781-
if self.context.channel_state.should_force_holding_cell() {
2781+
if self.context.channel_state.can_generate_new_commitment() {
27822782
// Note that this condition is the same as the assertion in
27832783
// `claim_htlc_while_disconnected_dropping_mon_update` and must match exactly -
27842784
// `claim_htlc_while_disconnected_dropping_mon_update` would not work correctly if we
@@ -2937,7 +2937,7 @@ impl<SP: Deref> Channel<SP> where
29372937
return Ok(None);
29382938
}
29392939

2940-
if self.context.channel_state.should_force_holding_cell() {
2940+
if self.context.channel_state.can_generate_new_commitment() {
29412941
debug_assert!(force_holding_cell, "!force_holding_cell is only called when emptying the holding cell, so we shouldn't end up back in it!");
29422942
force_holding_cell = true;
29432943
}
@@ -3636,7 +3636,7 @@ impl<SP: Deref> Channel<SP> where
36363636
) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
36373637
where F::Target: FeeEstimator, L::Target: Logger
36383638
{
3639-
if matches!(self.context.channel_state, ChannelState::ChannelReady(_)) && !self.context.channel_state.should_force_holding_cell() {
3639+
if matches!(self.context.channel_state, ChannelState::ChannelReady(_)) && !self.context.channel_state.can_generate_new_commitment() {
36403640
self.free_holding_cell_htlcs(fee_estimator, logger)
36413641
} else { (None, Vec::new()) }
36423642
}
@@ -5904,7 +5904,7 @@ impl<SP: Deref> Channel<SP> where
59045904
return Err(ChannelError::Ignore("Cannot send an HTLC while disconnected from channel counterparty".to_owned()));
59055905
}
59065906

5907-
let need_holding_cell = self.context.channel_state.should_force_holding_cell();
5907+
let need_holding_cell = self.context.channel_state.can_generate_new_commitment();
59085908
log_debug!(logger, "Pushing new outbound HTLC with hash {} for {} msat {}",
59095909
payment_hash, amount_msat,
59105910
if force_holding_cell { "into holding cell" }

0 commit comments

Comments
 (0)