@@ -10300,7 +10300,7 @@ fn do_test_max_dust_htlc_exposure(dust_outbound_balance: bool, exposure_breach_e
1030010300 } else { 0 };
1030110301 let initial_feerate = if apply_excess_fee { 253 * 2 } else { 253 };
1030210302 let expected_dust_buffer_feerate = initial_feerate + 2530;
10303- let mut commitment_tx_cost = commit_tx_fee_msat(initial_feerate - 253, nondust_htlc_count_in_limit, &ChannelTypeFeatures::empty());
10303+ let mut commitment_tx_cost = chan_utils:: commit_tx_fee_msat(initial_feerate - 253, nondust_htlc_count_in_limit as usize , &ChannelTypeFeatures::empty());
1030410304 commitment_tx_cost +=
1030510305 if on_holder_tx {
1030610306 htlc_success_tx_weight(&ChannelTypeFeatures::empty())
@@ -10646,14 +10646,14 @@ fn do_test_nondust_htlc_fees_dust_exposure_delta(features: ChannelTypeFeatures)
1064610646 }
1064710647
1064810648 // Set `expected_dust_exposure_msat` to match the calculation in `FundedChannel::can_accept_incoming_htlc`
10649- // only_static_remote_key: 500_000 + 22 * (724 + 172) / 1000 * 1000 + 22 * 663 = 533_586
10650- // anchors_zero_htlc_fee: 500_000 + 22 * (1_124 + 172) / 1000 * 1000 = 528_000
10651- let mut expected_dust_exposure_msat = BASE_DUST_EXPOSURE_MSAT + EXCESS_FEERATE * (commitment_tx_base_weight(&features) + COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000 * 1000 ;
10649+ // only_static_remote_key: 500_000 + 22 * (724 + 172) + 22 * 663 = 534_298
10650+ // anchors_zero_htlc_fee: 500_000 + 22 * (1_124 + 172) = 528_512
10651+ let mut expected_dust_exposure_msat = BASE_DUST_EXPOSURE_MSAT + EXCESS_FEERATE * (commitment_tx_base_weight(&features) + COMMITMENT_TX_WEIGHT_PER_HTLC);
1065210652 if features == ChannelTypeFeatures::only_static_remote_key() {
1065310653 expected_dust_exposure_msat += EXCESS_FEERATE * htlc_timeout_tx_weight(&features);
10654- assert_eq!(expected_dust_exposure_msat, 533_586 );
10654+ assert_eq!(expected_dust_exposure_msat, 534_298 );
1065510655 } else {
10656- assert_eq!(expected_dust_exposure_msat, 528_000 );
10656+ assert_eq!(expected_dust_exposure_msat, 528_512 );
1065710657 }
1065810658
1065910659 let mut default_config = test_default_channel_config();
@@ -10749,15 +10749,13 @@ fn do_test_nondust_htlc_fees_dust_exposure_delta(features: ChannelTypeFeatures)
1074910749 assert_eq!(nodes[0].node.list_channels()[0].pending_outbound_htlcs.len(), DUST_HTLC_COUNT);
1075010750 assert_eq!(nodes[1].node.list_channels()[0].pending_inbound_htlcs.len(), DUST_HTLC_COUNT);
1075110751
10752- // Set `expected_dust_exposure_msat` to match the calculation in `ChannelContext::get_available_balances`
10753- // only_static_remote_key: 500_000 + 22 * 724 / 1000 * 1000 + 22 * 172 + 22 * 703 = 534_250
10754- // anchors_zero_htlc_fee: 500_000 + 22 * 1124 / 1000 * 1000 + 22 * 172 = 527_784
10755- let mut expected_dust_exposure_msat = BASE_DUST_EXPOSURE_MSAT + EXCESS_FEERATE * commitment_tx_base_weight(&features) / 1000 * 1000 + EXCESS_FEERATE * COMMITMENT_TX_WEIGHT_PER_HTLC;
10752+ // The `expected_dust_exposure_msat` for the outbound htlc changes in the non-anchor case, as the htlc success and timeout transactions have different weights
10753+ // only_static_remote_key: 500_000 + 22 * 724 + 22 * 172 + 22 * 703 = 535_178
1075610754 if features == ChannelTypeFeatures::only_static_remote_key() {
10757- expected_dust_exposure_msat += EXCESS_FEERATE * htlc_success_tx_weight(&features);
10758- assert_eq!(expected_dust_exposure_msat, 534_250 );
10755+ expected_dust_exposure_msat = BASE_DUST_EXPOSURE_MSAT + EXCESS_FEERATE * commitment_tx_base_weight(&features) + EXCESS_FEERATE * COMMITMENT_TX_WEIGHT_PER_HTLC + EXCESS_FEERATE * htlc_success_tx_weight(&features);
10756+ assert_eq!(expected_dust_exposure_msat, 535_178 );
1075910757 } else {
10760- assert_eq!(expected_dust_exposure_msat, 527_784 );
10758+ assert_eq!(expected_dust_exposure_msat, 528_512 );
1076110759 }
1076210760
1076310761 // Set node 1's max dust htlc exposure to 1msat below `expected_dust_exposure_msat`
0 commit comments