Skip to content

Commit e71998f

Browse files
committed
fix: bypass feerate floor for cooperative close minimum
Use the raw fee estimator for ChannelCloseMinimum instead of bounded_sat_per_1000_weight to avoid the FEERATE_FLOOR_SATS_PER_KW (253 sat/kwu) clamp. This prevents cooperative close negotiation from failing when the counterparty proposes a fee below the relay fee floor, which is common on signet/testnet and can occur on mainnet during low-fee periods. The floor is set to FEERATE_FLOOR / 2 (126 sat/kwu) as a safety net while still accepting proposals well below the standard floor.
1 parent 37f66f3 commit e71998f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use bitcoin::{secp256k1, sighash, FeeRate, Sequence, TxIn};
2929
use crate::blinded_path::message::BlindedMessagePath;
3030
use crate::chain::chaininterface::{
3131
fee_for_weight, ConfirmationTarget, FeeEstimator, LowerBoundedFeeEstimator, TransactionType,
32+
FEERATE_FLOOR_SATS_PER_KW,
3233
};
3334
use crate::chain::channelmonitor::{
3435
ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateStep, CommitmentHTLCData,
@@ -10150,8 +10151,15 @@ where
1015010151
// Propose a range from our current Background feerate to our Normal feerate plus our
1015110152
// force_close_avoidance_max_fee_satoshis.
1015210153
// If we fail to come to consensus, we'll have to force-close.
10153-
let mut proposed_feerate =
10154-
fee_estimator.bounded_sat_per_1000_weight(ConfirmationTarget::ChannelCloseMinimum);
10154+
//
10155+
// Use the raw fee estimator for ChannelCloseMinimum to avoid the
10156+
// FEERATE_FLOOR_SATS_PER_KW (253) clamp. Cooperative closes are not
10157+
// time-sensitive and accepting a lower-than-relay fee is preferable to
10158+
// falling back to a force close.
10159+
let mut proposed_feerate = cmp::max(
10160+
fee_estimator.0.get_est_sat_per_1000_weight(ConfirmationTarget::ChannelCloseMinimum),
10161+
FEERATE_FLOOR_SATS_PER_KW / 2,
10162+
);
1015510163
// Use NonAnchorChannelFee because this should be an estimate for a channel close
1015610164
// that we don't expect to need fee bumping
1015710165
let normal_feerate =

0 commit comments

Comments
 (0)