@@ -5469,6 +5469,7 @@ impl<SP: SignerProvider> ChannelContext<SP> {
54695469 } else {
54705470 1
54715471 };
5472+ // Note that the feerate is 0 in zero-fee commitment channels, so this statement is a noop
54725473 let spiked_feerate = feerate * fee_spike_multiple;
54735474 let (remote_stats, _remote_htlcs) = self
54745475 .get_next_remote_commitment_stats(
@@ -12401,14 +12402,23 @@ where
1240112402 // We are not interested in dust exposure
1240212403 let dust_exposure_limiting_feerate = None;
1240312404
12405+ // Note that the feerate is 0 in zero-fee commitment channels, so this statement is a noop
12406+ let feerate_per_kw = if !funding.get_channel_type().supports_anchors_zero_fee_htlc_tx() {
12407+ // Similar to HTLC additions, require the funder to have enough funds reserved for
12408+ // fees such that the feerate can jump without rendering the channel useless.
12409+ self.context.feerate_per_kw * FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE as u32
12410+ } else {
12411+ self.context.feerate_per_kw
12412+ };
12413+
1240412414 let (local_stats, _local_htlcs) = self
1240512415 .context
1240612416 .get_next_local_commitment_stats(
1240712417 funding,
1240812418 None, // htlc_candidate
1240912419 include_counterparty_unknown_htlcs,
1241012420 addl_nondust_htlc_count,
12411- self.context. feerate_per_kw,
12421+ feerate_per_kw,
1241212422 dust_exposure_limiting_feerate,
1241312423 )
1241412424 .map_err(|()| "Balance exhausted on local commitment")?;
@@ -12420,7 +12430,7 @@ where
1242012430 None, // htlc_candidate
1242112431 include_counterparty_unknown_htlcs,
1242212432 addl_nondust_htlc_count,
12423- self.context. feerate_per_kw,
12433+ feerate_per_kw,
1242412434 dust_exposure_limiting_feerate,
1242512435 )
1242612436 .map_err(|()| "Balance exhausted on remote commitment")?;
0 commit comments