@@ -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
}
@@ -4946,11 +4954,18 @@ where
4946
4954
// and the answer will in turn change the amount itself — making it a circular
4947
4955
// dependency.
4948
4956
// This complicates the computation around dust-values, up to the one-htlc-value.
4957
+ let fee_spike_buffer_htlc = if funding.get_channel_type().supports_anchor_zero_fee_commitments() {
4958
+ None
4959
+ } else {
4960
+ Some(())
4961
+ };
4962
+
4949
4963
let real_dust_limit_timeout_sat = real_htlc_timeout_tx_fee_sat + context.holder_dust_limit_satoshis;
4950
4964
let htlc_above_dust = HTLCCandidate::new(real_dust_limit_timeout_sat * 1000, HTLCInitiator::LocalOffered);
4951
- let mut max_reserved_commit_tx_fee_msat = context.next_local_commit_tx_fee_msat(funding, htlc_above_dust, Some(()) );
4965
+ let mut max_reserved_commit_tx_fee_msat = context.next_local_commit_tx_fee_msat(& funding, htlc_above_dust, fee_spike_buffer_htlc );
4952
4966
let htlc_dust = HTLCCandidate::new(real_dust_limit_timeout_sat * 1000 - 1, HTLCInitiator::LocalOffered);
4953
- let mut min_reserved_commit_tx_fee_msat = context.next_local_commit_tx_fee_msat(funding, htlc_dust, Some(()));
4967
+ let mut min_reserved_commit_tx_fee_msat = context.next_local_commit_tx_fee_msat(&funding, htlc_dust, fee_spike_buffer_htlc);
4968
+
4954
4969
if !funding.get_channel_type().supports_anchors_zero_fee_htlc_tx() {
4955
4970
max_reserved_commit_tx_fee_msat *= FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE;
4956
4971
min_reserved_commit_tx_fee_msat *= FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE;
@@ -5068,6 +5083,7 @@ where
5068
5083
5069
5084
if funding.get_channel_type().supports_anchor_zero_fee_commitments() {
5070
5085
debug_assert_eq!(context.feerate_per_kw, 0);
5086
+ debug_assert!(fee_spike_buffer_htlc.is_none());
5071
5087
return 0;
5072
5088
}
5073
5089
@@ -5177,6 +5193,7 @@ where
5177
5193
5178
5194
if funding.get_channel_type().supports_anchor_zero_fee_commitments() {
5179
5195
debug_assert_eq!(context.feerate_per_kw, 0);
5196
+ debug_assert!(fee_spike_buffer_htlc.is_none());
5180
5197
return 0
5181
5198
}
5182
5199
0 commit comments