Skip to content

Commit 188f299

Browse files
committed
Remove extra addition of dust due to excess counterparty htlc tx fees
In `can_accept_incoming_htlc`, `get_pending_htlc_stats` accounts for the incoming htlc. Therefore, `on_counterparty_tx_dust_exposure_msat` already includes the excess tx fees of the incoming non-dust htlc.
1 parent 35dd3a8 commit 188f299

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lightning/src/ln/channel.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7333,13 +7333,10 @@ impl<SP: Deref> FundedChannel<SP> where
73337333
return Err(("Exceeded our dust exposure limit on counterparty commitment tx", 0x1000|7))
73347334
}
73357335
} else {
7336-
let htlc_dust_exposure_msat =
7337-
per_outbound_htlc_counterparty_commit_tx_fee_msat(self.context.feerate_per_kw, &self.context.channel_type);
7338-
let counterparty_tx_dust_exposure =
7339-
htlc_stats.on_counterparty_tx_dust_exposure_msat.saturating_add(htlc_dust_exposure_msat);
7340-
if counterparty_tx_dust_exposure > max_dust_htlc_exposure_msat {
7336+
let on_counterparty_tx_dust_htlc_exposure_msat = htlc_stats.on_counterparty_tx_dust_exposure_msat;
7337+
if on_counterparty_tx_dust_htlc_exposure_msat > max_dust_htlc_exposure_msat {
73417338
log_info!(logger, "Cannot accept value that would put our exposure to tx fee dust at {} over the limit {} on counterparty commitment tx",
7342-
counterparty_tx_dust_exposure, max_dust_htlc_exposure_msat);
7339+
on_counterparty_tx_dust_htlc_exposure_msat, max_dust_htlc_exposure_msat);
73437340
return Err(("Exceeded our tx fee dust exposure limit on counterparty commitment tx", 0x1000|7))
73447341
}
73457342
}

0 commit comments

Comments
 (0)