Skip to content

Commit cd4dc39

Browse files
authored
Merge pull request #1208 from TheBlueMatt/2021-12-less-force-close
Reduce force-closures with user fee estimators which round poorly
2 parents cd9cd47 + d5e70ad commit cd4dc39

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,8 +862,12 @@ impl<Signer: Sign> Channel<Signer> {
862862
where F::Target: FeeEstimator
863863
{
864864
let lower_limit = fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::Background);
865-
if feerate_per_kw < lower_limit {
866-
return Err(ChannelError::Close(format!("Peer's feerate much too low. Actual: {}. Our expected lower limit: {}", feerate_per_kw, lower_limit)));
865+
// Some fee estimators round up to the next full sat/vbyte (ie 250 sats per kw), causing
866+
// occasional issues with feerate disagreements between an initiator that wants a feerate
867+
// of 1.1 sat/vbyte and a receiver that wants 1.1 rounded up to 2. Thus, we always add 250
868+
// sat/kw before the comparison here.
869+
if feerate_per_kw + 250 < lower_limit {
870+
return Err(ChannelError::Close(format!("Peer's feerate much too low. Actual: {}. Our expected lower limit: {} (- 250)", feerate_per_kw, lower_limit)));
867871
}
868872
// We only bound the fee updates on the upper side to prevent completely absurd feerates,
869873
// always accepting up to 25 sat/vByte or 10x our fee estimator's "High Priority" fee.

0 commit comments

Comments
 (0)