You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fixup: Improve prediction of commitment stats in can_accept_incoming_htlc
Turn the unwrap_or(0) into an expect; `can_accept_incoming_htlc` is
called when the inbound HTLC is already irrevocably committed to the
channel, so we should have rejected the HTLC at `update_add_htlc` if it
exhausts the counterparty's balance.
let remote_balance_before_fee_msat = next_remote_commitment_stats.counterparty_balance_msat.unwrap_or(0);
4589
+
// We unwrap here; if the HTLC exhausts the counterparty's balance, we should have rejected it at `update_add_htlc`, here the HTLC is already
4590
+
// irrevocably committed to the channel.
4591
+
let remote_balance_before_fee_msat = next_remote_commitment_stats.counterparty_balance_msat.expect("The counterparty's balance before fees should never underflow");
4590
4592
if remote_balance_before_fee_msat.saturating_sub(funding.holder_selected_channel_reserve_satoshis * 1000) < remote_fee_incl_fee_spike_buffer_htlc_msat {
4591
4593
log_info!(logger, "Attempting to fail HTLC due to fee spike buffer violation in channel {}. Rebalancing is required.", &self.channel_id());
0 commit comments