@@ -95,12 +95,14 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
95
95
BOOST_CHECK (it_parent != result_parent_child.m_tx_results .end ());
96
96
BOOST_CHECK_MESSAGE (it_parent->second .m_state .IsValid (),
97
97
" Package validation unexpectedly failed: " << it_parent->second .m_state .GetRejectReason ());
98
+ BOOST_CHECK (it_parent->second .m_effective_feerate .value ().GetFee (GetVirtualTransactionSize (*tx_parent)) == COIN);
98
99
BOOST_CHECK (it_child != result_parent_child.m_tx_results .end ());
99
100
BOOST_CHECK_MESSAGE (it_child->second .m_state .IsValid (),
100
101
" Package validation unexpectedly failed: " << it_child->second .m_state .GetRejectReason ());
101
102
BOOST_CHECK (result_parent_child.m_package_feerate .has_value ());
102
103
BOOST_CHECK (result_parent_child.m_package_feerate .value () ==
103
104
CFeeRate (2 * COIN, GetVirtualTransactionSize (*tx_parent) + GetVirtualTransactionSize (*tx_child)));
105
+ BOOST_CHECK (it_child->second .m_effective_feerate .value ().GetFee (GetVirtualTransactionSize (*tx_child)) == COIN);
104
106
105
107
// A single, giant transaction submitted through ProcessNewPackage fails on single tx policy.
106
108
CTransactionRef giant_ptx = create_placeholder_tx (999 , 999 );
@@ -323,8 +325,10 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
323
325
auto it_child = submit_parent_child.m_tx_results .find (tx_child->GetWitnessHash ());
324
326
BOOST_CHECK (it_parent != submit_parent_child.m_tx_results .end ());
325
327
BOOST_CHECK (it_parent->second .m_state .IsValid ());
328
+ BOOST_CHECK (it_parent->second .m_effective_feerate == CFeeRate (1 * COIN, GetVirtualTransactionSize (*tx_parent)));
326
329
BOOST_CHECK (it_child != submit_parent_child.m_tx_results .end ());
327
330
BOOST_CHECK (it_child->second .m_state .IsValid ());
331
+ BOOST_CHECK (it_child->second .m_effective_feerate == CFeeRate (1 * COIN, GetVirtualTransactionSize (*tx_child)));
328
332
329
333
BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
330
334
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Txid (tx_parent->GetHash ())));
@@ -613,6 +617,8 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
613
617
BOOST_CHECK_MESSAGE (mixed_result.m_package_feerate .value () == expected_feerate,
614
618
strprintf (" Expected package feerate %s, got %s" , expected_feerate.ToString (),
615
619
mixed_result.m_package_feerate .value ().ToString ()));
620
+ BOOST_CHECK (it_parent3->second .m_effective_feerate .value () == expected_feerate);
621
+ BOOST_CHECK (it_child->second .m_effective_feerate .value () == expected_feerate);
616
622
}
617
623
}
618
624
@@ -695,6 +701,8 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
695
701
696
702
const CFeeRate expected_feerate (coinbase_value - child_value,
697
703
GetVirtualTransactionSize (*tx_parent) + GetVirtualTransactionSize (*tx_child));
704
+ BOOST_CHECK (it_parent->second .m_effective_feerate .value () == expected_feerate);
705
+ BOOST_CHECK (it_child->second .m_effective_feerate .value () == expected_feerate);
698
706
BOOST_CHECK (expected_feerate.GetFeePerK () > 1000 );
699
707
BOOST_CHECK (submit_cpfp.m_package_feerate .has_value ());
700
708
BOOST_CHECK_MESSAGE (submit_cpfp.m_package_feerate .value () == expected_feerate,
@@ -756,6 +764,16 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
756
764
BOOST_CHECK_MESSAGE (submit_prioritised_package.m_package_feerate .value () == expected_feerate,
757
765
strprintf (" Expected package feerate %s, got %s" , expected_feerate.ToString (),
758
766
submit_prioritised_package.m_package_feerate .value ().ToString ()));
767
+ auto it_parent = submit_prioritised_package.m_tx_results .find (tx_parent_cheap->GetWitnessHash ());
768
+ auto it_child = submit_prioritised_package.m_tx_results .find (tx_child_cheap->GetWitnessHash ());
769
+ BOOST_CHECK (it_parent != submit_prioritised_package.m_tx_results .end ());
770
+ BOOST_CHECK (it_parent->second .m_result_type == MempoolAcceptResult::ResultType::VALID);
771
+ BOOST_CHECK (it_parent->second .m_base_fees .value () == 0 );
772
+ BOOST_CHECK (it_parent->second .m_effective_feerate .value () == expected_feerate);
773
+ BOOST_CHECK (it_child != submit_prioritised_package.m_tx_results .end ());
774
+ BOOST_CHECK (it_child->second .m_result_type == MempoolAcceptResult::ResultType::VALID);
775
+ BOOST_CHECK (it_child->second .m_base_fees .value () == 200 );
776
+ BOOST_CHECK (it_child->second .m_effective_feerate .value () == expected_feerate);
759
777
}
760
778
761
779
// Package feerate is calculated without topology in mind; it's just aggregating fees and sizes.
@@ -801,6 +819,7 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
801
819
BOOST_CHECK (it_parent->second .m_state .GetRejectReason () == " " );
802
820
BOOST_CHECK_MESSAGE (it_parent->second .m_base_fees .value () == high_parent_fee,
803
821
strprintf (" rich parent: expected fee %s, got %s" , high_parent_fee, it_parent->second .m_base_fees .value ()));
822
+ BOOST_CHECK (it_parent->second .m_effective_feerate == CFeeRate (high_parent_fee, GetVirtualTransactionSize (*tx_parent_rich)));
804
823
805
824
BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
806
825
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Txid (tx_parent_rich->GetHash ())));
0 commit comments