@@ -4414,14 +4414,22 @@ where
4414
4414
funding.get_channel_type()
4415
4415
);
4416
4416
4417
- // `Some(())` is for the fee spike buffer we keep for the remote. This deviates from
4418
- // the spec because the fee spike buffer requirement doesn't exist on the receiver's
4419
- // side, only on the sender's. Note that with anchor outputs we are no longer as
4420
- // sensitive to fee spikes, so we need to account for them.
4417
+ // `Some(())` is for the fee spike buffer we keep for the remote if the channel is
4418
+ // not zero fee.. This deviates from the spec because the fee spike buffer requirement
4419
+ // doesn't exist on the receiver's side, only on the sender's. Note that with anchor
4420
+ // outputs we are no longer as sensitive to fee spikes, so we need to account for them.
4421
4421
//
4422
4422
// A `None` `HTLCCandidate` is used as in this case because we're already accounting for
4423
4423
// the incoming HTLC as it has been fully committed by both sides.
4424
- let mut remote_fee_cost_incl_stuck_buffer_msat = self.next_remote_commit_tx_fee_msat(funding, None, Some(()));
4424
+ let fee_spike_buffer_htlc = if funding.get_channel_type().supports_anchor_zero_fee_commitments() {
4425
+ None
4426
+ } else {
4427
+ Some(())
4428
+ };
4429
+
4430
+ let mut remote_fee_cost_incl_stuck_buffer_msat = self.next_remote_commit_tx_fee_msat(
4431
+ funding, None, fee_spike_buffer_htlc,
4432
+ );
4425
4433
if !funding.get_channel_type().supports_anchors_zero_fee_htlc_tx() {
4426
4434
remote_fee_cost_incl_stuck_buffer_msat *= FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE;
4427
4435
}
@@ -4947,11 +4955,18 @@ where
4947
4955
// and the answer will in turn change the amount itself — making it a circular
4948
4956
// dependency.
4949
4957
// This complicates the computation around dust-values, up to the one-htlc-value.
4958
+ let fee_spike_buffer_htlc = if funding.get_channel_type().supports_anchor_zero_fee_commitments() {
4959
+ None
4960
+ } else {
4961
+ Some(())
4962
+ };
4963
+
4950
4964
let real_dust_limit_timeout_sat = real_htlc_timeout_tx_fee_sat + context.holder_dust_limit_satoshis;
4951
4965
let htlc_above_dust = HTLCCandidate::new(real_dust_limit_timeout_sat * 1000, HTLCInitiator::LocalOffered);
4952
- let mut max_reserved_commit_tx_fee_msat = context.next_local_commit_tx_fee_msat(funding, htlc_above_dust, Some(()) );
4966
+ let mut max_reserved_commit_tx_fee_msat = context.next_local_commit_tx_fee_msat(& funding, htlc_above_dust, fee_spike_buffer_htlc );
4953
4967
let htlc_dust = HTLCCandidate::new(real_dust_limit_timeout_sat * 1000 - 1, HTLCInitiator::LocalOffered);
4954
- let mut min_reserved_commit_tx_fee_msat = context.next_local_commit_tx_fee_msat(funding, htlc_dust, Some(()));
4968
+ let mut min_reserved_commit_tx_fee_msat = context.next_local_commit_tx_fee_msat(&funding, htlc_dust, fee_spike_buffer_htlc);
4969
+
4955
4970
if !funding.get_channel_type().supports_anchors_zero_fee_htlc_tx() {
4956
4971
max_reserved_commit_tx_fee_msat *= FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE;
4957
4972
min_reserved_commit_tx_fee_msat *= FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE;
@@ -5069,6 +5084,7 @@ where
5069
5084
5070
5085
if funding.get_channel_type().supports_anchor_zero_fee_commitments() {
5071
5086
debug_assert_eq!(context.feerate_per_kw, 0);
5087
+ debug_assert!(fee_spike_buffer_htlc.is_none());
5072
5088
return 0;
5073
5089
}
5074
5090
@@ -5178,6 +5194,7 @@ where
5178
5194
5179
5195
if funding.get_channel_type().supports_anchor_zero_fee_commitments() {
5180
5196
debug_assert_eq!(context.feerate_per_kw, 0);
5197
+ debug_assert!(fee_spike_buffer_htlc.is_none());
5181
5198
return 0
5182
5199
}
5183
5200
0 commit comments