Skip to content

Commit f30fb62

Browse files
committed
Include any pending fee updates in can_accept_incoming_htlc stats
While these fee updates may currently be unknown to our counterparty, they can end up in commitments soon. Moreover, we are considering failing a single HTLC here, not the entire channel, so we opt to be conservative in what we accept to forward.
1 parent 061a725 commit f30fb62

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5031,6 +5031,9 @@ where
50315031
// single HTLC here, not the entire channel, so we opt to be conservative
50325032
// in what we accept to forward.
50335033
let include_counterparty_unknown_htlcs = true;
5034+
// Similar reasoning as above
5035+
let feerate =
5036+
cmp::max(self.feerate_per_kw, self.pending_update_fee.map(|(fee, _)| fee).unwrap_or(0));
50345037
// A `None` `HTLCCandidate` is used as in this case because we're already accounting for
50355038
// the incoming HTLC as it has been fully committed by both sides.
50365039
let next_local_commitment_stats = self
@@ -5039,7 +5042,7 @@ where
50395042
None,
50405043
include_counterparty_unknown_htlcs,
50415044
fee_spike_buffer_htlc,
5042-
self.feerate_per_kw,
5045+
feerate,
50435046
dust_exposure_limiting_feerate,
50445047
)
50455048
.map_err(|()| {
@@ -5052,7 +5055,7 @@ where
50525055
None,
50535056
include_counterparty_unknown_htlcs,
50545057
fee_spike_buffer_htlc,
5055-
self.feerate_per_kw,
5058+
feerate,
50565059
dust_exposure_limiting_feerate,
50575060
)
50585061
.map_err(|()| {

0 commit comments

Comments
 (0)