@@ -1903,7 +1903,7 @@ pub fn get_commitment_transaction_number_obscure_factor(
19031903mod tests {
19041904 use super :: { CounterpartyCommitmentSecrets , ChannelPublicKeys } ;
19051905 use crate :: chain;
1906- use crate :: ln:: chan_utils:: { get_htlc_redeemscript, get_to_countersignatory_with_anchors_redeemscript, CommitmentTransaction , TxCreationKeys , ChannelTransactionParameters , CounterpartyChannelTransactionParameters , HTLCOutputInCommitment , commit_tx_fee_sat , htlc_success_tx_weight , per_outbound_htlc_counterparty_commit_tx_fee_msat } ;
1906+ use crate :: ln:: chan_utils:: { get_htlc_redeemscript, get_to_countersignatory_with_anchors_redeemscript, CommitmentTransaction , TxCreationKeys , ChannelTransactionParameters , CounterpartyChannelTransactionParameters , HTLCOutputInCommitment } ;
19071907 use bitcoin:: secp256k1:: { PublicKey , SecretKey , Secp256k1 } ;
19081908 use crate :: util:: test_utils;
19091909 use crate :: sign:: { ChannelSigner , SignerProvider } ;
@@ -2440,35 +2440,4 @@ mod tests {
24402440 assert ! ( monitor. provide_secret( 281474976710648 , secrets. last( ) . unwrap( ) . clone( ) ) . is_err( ) ) ;
24412441 }
24422442 }
2443-
2444- #[ test]
2445- fn test_commit_tx_fee_sat_num_htlcs_slope_per_outbound_htlc_counterparty_commit_tx_fee_msat ( ) {
2446- // Test that the slope (commit_tx_fee_sat/num_htlcs) is consistent with per_outbound_htlc_counterparty_commit_tx_fee_msat.
2447- // `got`: floor(feerate * commit_tx_base_weight) + floor(num_htlcs * feerate * htlc_output_weight + num_htlcs * feerate * htlc_tx_weight)
2448- // `want`: floor(feerate * commit_tx_base_weight + num_htlcs * feerate * htlc_output_weight) + floor(num_htlcs * feerate * htlc_tx_weight)
2449- // At most, the difference between the two calculations is 1 satoshi, depending on how the num_htlcs * feerate * htlc_output_weight term
2450- // adds with the two others.
2451- //
2452- // In the case of anchor channels, set `htlc_tx_weight` above to zero; the fees are exogenous.
2453-
2454- let num_htlcs = 966 ; // BOLT #2 maximum number of htlcs on a commit tx
2455-
2456- let features = ChannelTypeFeatures :: only_static_remote_key ( ) ;
2457- // Tests the range 1sat/vb - 250sat/vb
2458- for feerate in 253 ..62500 {
2459- let got = commit_tx_fee_sat ( feerate, 0 , & features) + num_htlcs * per_outbound_htlc_counterparty_commit_tx_fee_msat ( feerate, & features) / 1000 ;
2460- let want = commit_tx_fee_sat ( feerate, num_htlcs as usize , & features) + num_htlcs * feerate as u64 * htlc_success_tx_weight ( & features) / 1000 ;
2461- let diff = u64:: abs_diff ( got, want) ;
2462- assert ! ( diff <= 1 , "assert failed for feerate: {}, absolute difference was: {}" , feerate, diff) ;
2463- }
2464-
2465- let features = ChannelTypeFeatures :: anchors_zero_htlc_fee_and_dependencies ( ) ;
2466- // Tests the range 1sat/vb - 250sat/vb
2467- for feerate in 253 ..62500 {
2468- let got = commit_tx_fee_sat ( feerate, 0 , & features) + num_htlcs * per_outbound_htlc_counterparty_commit_tx_fee_msat ( feerate, & features) / 1000 ;
2469- let want = commit_tx_fee_sat ( feerate, num_htlcs as usize , & features) ;
2470- let diff = u64:: checked_sub ( want, got) . expect ( "got should not be greater than want" ) ;
2471- assert ! ( diff <= 1 , "assert failed for feerate: {}, checked difference was: {}" , feerate, diff) ;
2472- }
2473- }
24742443}
0 commit comments