@@ -90,6 +90,7 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
9090 const auto result_parent_child = ProcessNewPackage (m_node.chainman ->ActiveChainstate (), *m_node.mempool , {tx_parent, tx_child}, /* test_accept=*/ true );
9191 BOOST_CHECK_MESSAGE (result_parent_child.m_state .IsValid (),
9292 " Package validation unexpectedly failed: " << result_parent_child.m_state .GetRejectReason ());
93+ BOOST_CHECK (result_parent_child.m_tx_results .size () == 2 );
9394 auto it_parent = result_parent_child.m_tx_results .find (tx_parent->GetWitnessHash ());
9495 auto it_child = result_parent_child.m_tx_results .find (tx_child->GetWitnessHash ());
9596 BOOST_CHECK (it_parent != result_parent_child.m_tx_results .end ());
@@ -112,6 +113,7 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
112113 BOOST_CHECK (result_single_large.m_state .IsInvalid ());
113114 BOOST_CHECK_EQUAL (result_single_large.m_state .GetResult (), PackageValidationResult::PCKG_TX);
114115 BOOST_CHECK_EQUAL (result_single_large.m_state .GetRejectReason (), " transaction failed" );
116+ BOOST_CHECK (result_single_large.m_tx_results .size () == 1 );
115117 auto it_giant_tx = result_single_large.m_tx_results .find (giant_ptx->GetWitnessHash ());
116118 BOOST_CHECK (it_giant_tx != result_single_large.m_tx_results .end ());
117119 BOOST_CHECK_EQUAL (it_giant_tx->second .m_state .GetRejectReason (), " tx-size" );
@@ -291,9 +293,15 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
291293 BOOST_CHECK (result_quit_early.m_state .IsInvalid ());
292294 BOOST_CHECK_EQUAL (result_quit_early.m_state .GetResult (), PackageValidationResult::PCKG_TX);
293295 BOOST_CHECK (!result_quit_early.m_tx_results .empty ());
296+ BOOST_CHECK_EQUAL (result_quit_early.m_tx_results .size (), 2 );
294297 auto it_parent = result_quit_early.m_tx_results .find (tx_parent_invalid->GetWitnessHash ());
298+ auto it_child = result_quit_early.m_tx_results .find (tx_child->GetWitnessHash ());
295299 BOOST_CHECK (it_parent != result_quit_early.m_tx_results .end ());
300+ BOOST_CHECK (it_child != result_quit_early.m_tx_results .end ());
296301 BOOST_CHECK_EQUAL (it_parent->second .m_state .GetResult (), TxValidationResult::TX_WITNESS_MUTATED);
302+ BOOST_CHECK_EQUAL (it_parent->second .m_state .GetRejectReason (), " bad-witness-nonstandard" );
303+ BOOST_CHECK_EQUAL (it_child->second .m_state .GetResult (), TxValidationResult::TX_MISSING_INPUTS);
304+ BOOST_CHECK_EQUAL (it_child->second .m_state .GetRejectReason (), " bad-txns-inputs-missingorspent" );
297305 }
298306
299307 // Child with missing parent.
@@ -317,6 +325,7 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
317325 expected_pool_size += 2 ;
318326 BOOST_CHECK_MESSAGE (submit_parent_child.m_state .IsValid (),
319327 " Package validation unexpectedly failed: " << submit_parent_child.m_state .GetRejectReason ());
328+ BOOST_CHECK_EQUAL (submit_parent_child.m_tx_results .size (), package_parent_child.size ());
320329 auto it_parent = submit_parent_child.m_tx_results .find (tx_parent->GetWitnessHash ());
321330 auto it_child = submit_parent_child.m_tx_results .find (tx_child->GetWitnessHash ());
322331 BOOST_CHECK (it_parent != submit_parent_child.m_tx_results .end ());
@@ -341,6 +350,7 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
341350 package_parent_child, /* test_accept=*/ false );
342351 BOOST_CHECK_MESSAGE (submit_deduped.m_state .IsValid (),
343352 " Package validation unexpectedly failed: " << submit_deduped.m_state .GetRejectReason ());
353+ BOOST_CHECK_EQUAL (submit_deduped.m_tx_results .size (), package_parent_child.size ());
344354 auto it_parent_deduped = submit_deduped.m_tx_results .find (tx_parent->GetWitnessHash ());
345355 auto it_child_deduped = submit_deduped.m_tx_results .find (tx_child->GetWitnessHash ());
346356 BOOST_CHECK (it_parent_deduped != submit_deduped.m_tx_results .end ());
@@ -415,6 +425,7 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
415425 {ptx_parent, ptx_child1}, /* test_accept=*/ false );
416426 BOOST_CHECK_MESSAGE (submit_witness1.m_state .IsValid (),
417427 " Package validation unexpectedly failed: " << submit_witness1.m_state .GetRejectReason ());
428+ BOOST_CHECK_EQUAL (submit_witness1.m_tx_results .size (), 2 );
418429 auto it_parent1 = submit_witness1.m_tx_results .find (ptx_parent->GetWitnessHash ());
419430 auto it_child1 = submit_witness1.m_tx_results .find (ptx_child1->GetWitnessHash ());
420431 BOOST_CHECK (it_parent1 != submit_witness1.m_tx_results .end ());
@@ -432,6 +443,7 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
432443 {ptx_parent, ptx_child2}, /* test_accept=*/ false );
433444 BOOST_CHECK_MESSAGE (submit_witness2.m_state .IsValid (),
434445 " Package validation unexpectedly failed: " << submit_witness2.m_state .GetRejectReason ());
446+ BOOST_CHECK_EQUAL (submit_witness2.m_tx_results .size (), 2 );
435447 auto it_parent2_deduped = submit_witness2.m_tx_results .find (ptx_parent->GetWitnessHash ());
436448 auto it_child2 = submit_witness2.m_tx_results .find (ptx_child2->GetWitnessHash ());
437449 BOOST_CHECK (it_parent2_deduped != submit_witness2.m_tx_results .end ());
@@ -449,6 +461,7 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
449461 {ptx_parent, ptx_child1}, /* test_accept=*/ false );
450462 BOOST_CHECK_MESSAGE (submit_segwit_dedup.m_state .IsValid (),
451463 " Package validation unexpectedly failed: " << submit_segwit_dedup.m_state .GetRejectReason ());
464+ BOOST_CHECK_EQUAL (submit_segwit_dedup.m_tx_results .size (), 2 );
452465 auto it_parent_dup = submit_segwit_dedup.m_tx_results .find (ptx_parent->GetWitnessHash ());
453466 auto it_child_dup = submit_segwit_dedup.m_tx_results .find (ptx_child1->GetWitnessHash ());
454467 BOOST_CHECK (it_parent_dup->second .m_result_type == MempoolAcceptResult::ResultType::MEMPOOL_ENTRY);
@@ -477,6 +490,7 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
477490 {ptx_child2, ptx_grandchild}, /* test_accept=*/ false );
478491 BOOST_CHECK_MESSAGE (submit_spend_ignored.m_state .IsValid (),
479492 " Package validation unexpectedly failed: " << submit_spend_ignored.m_state .GetRejectReason ());
493+ BOOST_CHECK_EQUAL (submit_spend_ignored.m_tx_results .size (), 2 );
480494 auto it_child2_ignored = submit_spend_ignored.m_tx_results .find (ptx_child2->GetWitnessHash ());
481495 auto it_grandchild = submit_spend_ignored.m_tx_results .find (ptx_grandchild->GetWitnessHash ());
482496 BOOST_CHECK (it_child2_ignored != submit_spend_ignored.m_tx_results .end ());
@@ -577,6 +591,7 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
577591 {
578592 const auto mixed_result = ProcessNewPackage (m_node.chainman ->ActiveChainstate (), *m_node.mempool , package_mixed, false );
579593 BOOST_CHECK_MESSAGE (mixed_result.m_state .IsValid (), mixed_result.m_state .GetRejectReason ());
594+ BOOST_CHECK_EQUAL (mixed_result.m_tx_results .size (), package_mixed.size ());
580595 auto it_parent1 = mixed_result.m_tx_results .find (ptx_parent1->GetWitnessHash ());
581596 auto it_parent2 = mixed_result.m_tx_results .find (ptx_parent2_v1->GetWitnessHash ());
582597 auto it_parent3 = mixed_result.m_tx_results .find (ptx_parent3->GetWitnessHash ());
@@ -648,6 +663,7 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
648663 BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
649664 const auto submit_cpfp_deprio = ProcessNewPackage (m_node.chainman ->ActiveChainstate (), *m_node.mempool ,
650665 package_cpfp, /* test_accept=*/ false );
666+ BOOST_CHECK_EQUAL (submit_cpfp_deprio.m_state .GetResult (), PackageValidationResult::PCKG_POLICY);
651667 BOOST_CHECK_MESSAGE (submit_cpfp_deprio.m_state .IsInvalid (),
652668 " Package validation unexpectedly succeeded: " << submit_cpfp_deprio.m_state .GetRejectReason ());
653669 BOOST_CHECK (submit_cpfp_deprio.m_tx_results .empty ());
@@ -667,6 +683,7 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
667683 expected_pool_size += 2 ;
668684 BOOST_CHECK_MESSAGE (submit_cpfp.m_state .IsValid (),
669685 " Package validation unexpectedly failed: " << submit_cpfp.m_state .GetRejectReason ());
686+ BOOST_CHECK_EQUAL (submit_cpfp.m_tx_results .size (), package_cpfp.size ());
670687 auto it_parent = submit_cpfp.m_tx_results .find (tx_parent->GetWitnessHash ());
671688 auto it_child = submit_cpfp.m_tx_results .find (tx_child->GetWitnessHash ());
672689 BOOST_CHECK (it_parent != submit_cpfp.m_tx_results .end ());
@@ -736,6 +753,7 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
736753 " Package validation unexpectedly failed" << submit_prioritised_package.m_state .GetRejectReason ());
737754 const CFeeRate expected_feerate (1 * COIN + 200 ,
738755 GetVirtualTransactionSize (*tx_parent_cheap) + GetVirtualTransactionSize (*tx_child_cheap));
756+ BOOST_CHECK_EQUAL (submit_prioritised_package.m_tx_results .size (), package_still_too_low.size ());
739757 auto it_parent = submit_prioritised_package.m_tx_results .find (tx_parent_cheap->GetWitnessHash ());
740758 auto it_child = submit_prioritised_package.m_tx_results .find (tx_child_cheap->GetWitnessHash ());
741759 BOOST_CHECK (it_parent != submit_prioritised_package.m_tx_results .end ());
0 commit comments