@@ -90,6 +90,7 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
90
90
const auto result_parent_child = ProcessNewPackage (m_node.chainman ->ActiveChainstate (), *m_node.mempool , {tx_parent, tx_child}, /* test_accept=*/ true );
91
91
BOOST_CHECK_MESSAGE (result_parent_child.m_state .IsValid (),
92
92
" Package validation unexpectedly failed: " << result_parent_child.m_state .GetRejectReason ());
93
+ BOOST_CHECK (result_parent_child.m_tx_results .size () == 2 );
93
94
auto it_parent = result_parent_child.m_tx_results .find (tx_parent->GetWitnessHash ());
94
95
auto it_child = result_parent_child.m_tx_results .find (tx_child->GetWitnessHash ());
95
96
BOOST_CHECK (it_parent != result_parent_child.m_tx_results .end ());
@@ -112,6 +113,7 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
112
113
BOOST_CHECK (result_single_large.m_state .IsInvalid ());
113
114
BOOST_CHECK_EQUAL (result_single_large.m_state .GetResult (), PackageValidationResult::PCKG_TX);
114
115
BOOST_CHECK_EQUAL (result_single_large.m_state .GetRejectReason (), " transaction failed" );
116
+ BOOST_CHECK (result_single_large.m_tx_results .size () == 1 );
115
117
auto it_giant_tx = result_single_large.m_tx_results .find (giant_ptx->GetWitnessHash ());
116
118
BOOST_CHECK (it_giant_tx != result_single_large.m_tx_results .end ());
117
119
BOOST_CHECK_EQUAL (it_giant_tx->second .m_state .GetRejectReason (), " tx-size" );
@@ -291,9 +293,15 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
291
293
BOOST_CHECK (result_quit_early.m_state .IsInvalid ());
292
294
BOOST_CHECK_EQUAL (result_quit_early.m_state .GetResult (), PackageValidationResult::PCKG_TX);
293
295
BOOST_CHECK (!result_quit_early.m_tx_results .empty ());
296
+ BOOST_CHECK_EQUAL (result_quit_early.m_tx_results .size (), 2 );
294
297
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 ());
295
299
BOOST_CHECK (it_parent != result_quit_early.m_tx_results .end ());
300
+ BOOST_CHECK (it_child != result_quit_early.m_tx_results .end ());
296
301
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" );
297
305
}
298
306
299
307
// Child with missing parent.
@@ -317,6 +325,7 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
317
325
expected_pool_size += 2 ;
318
326
BOOST_CHECK_MESSAGE (submit_parent_child.m_state .IsValid (),
319
327
" 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 ());
320
329
auto it_parent = submit_parent_child.m_tx_results .find (tx_parent->GetWitnessHash ());
321
330
auto it_child = submit_parent_child.m_tx_results .find (tx_child->GetWitnessHash ());
322
331
BOOST_CHECK (it_parent != submit_parent_child.m_tx_results .end ());
@@ -341,6 +350,7 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
341
350
package_parent_child, /* test_accept=*/ false );
342
351
BOOST_CHECK_MESSAGE (submit_deduped.m_state .IsValid (),
343
352
" Package validation unexpectedly failed: " << submit_deduped.m_state .GetRejectReason ());
353
+ BOOST_CHECK_EQUAL (submit_deduped.m_tx_results .size (), package_parent_child.size ());
344
354
auto it_parent_deduped = submit_deduped.m_tx_results .find (tx_parent->GetWitnessHash ());
345
355
auto it_child_deduped = submit_deduped.m_tx_results .find (tx_child->GetWitnessHash ());
346
356
BOOST_CHECK (it_parent_deduped != submit_deduped.m_tx_results .end ());
@@ -415,6 +425,7 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
415
425
{ptx_parent, ptx_child1}, /* test_accept=*/ false );
416
426
BOOST_CHECK_MESSAGE (submit_witness1.m_state .IsValid (),
417
427
" Package validation unexpectedly failed: " << submit_witness1.m_state .GetRejectReason ());
428
+ BOOST_CHECK_EQUAL (submit_witness1.m_tx_results .size (), 2 );
418
429
auto it_parent1 = submit_witness1.m_tx_results .find (ptx_parent->GetWitnessHash ());
419
430
auto it_child1 = submit_witness1.m_tx_results .find (ptx_child1->GetWitnessHash ());
420
431
BOOST_CHECK (it_parent1 != submit_witness1.m_tx_results .end ());
@@ -432,6 +443,7 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
432
443
{ptx_parent, ptx_child2}, /* test_accept=*/ false );
433
444
BOOST_CHECK_MESSAGE (submit_witness2.m_state .IsValid (),
434
445
" Package validation unexpectedly failed: " << submit_witness2.m_state .GetRejectReason ());
446
+ BOOST_CHECK_EQUAL (submit_witness2.m_tx_results .size (), 2 );
435
447
auto it_parent2_deduped = submit_witness2.m_tx_results .find (ptx_parent->GetWitnessHash ());
436
448
auto it_child2 = submit_witness2.m_tx_results .find (ptx_child2->GetWitnessHash ());
437
449
BOOST_CHECK (it_parent2_deduped != submit_witness2.m_tx_results .end ());
@@ -449,6 +461,7 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
449
461
{ptx_parent, ptx_child1}, /* test_accept=*/ false );
450
462
BOOST_CHECK_MESSAGE (submit_segwit_dedup.m_state .IsValid (),
451
463
" Package validation unexpectedly failed: " << submit_segwit_dedup.m_state .GetRejectReason ());
464
+ BOOST_CHECK_EQUAL (submit_segwit_dedup.m_tx_results .size (), 2 );
452
465
auto it_parent_dup = submit_segwit_dedup.m_tx_results .find (ptx_parent->GetWitnessHash ());
453
466
auto it_child_dup = submit_segwit_dedup.m_tx_results .find (ptx_child1->GetWitnessHash ());
454
467
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)
477
490
{ptx_child2, ptx_grandchild}, /* test_accept=*/ false );
478
491
BOOST_CHECK_MESSAGE (submit_spend_ignored.m_state .IsValid (),
479
492
" Package validation unexpectedly failed: " << submit_spend_ignored.m_state .GetRejectReason ());
493
+ BOOST_CHECK_EQUAL (submit_spend_ignored.m_tx_results .size (), 2 );
480
494
auto it_child2_ignored = submit_spend_ignored.m_tx_results .find (ptx_child2->GetWitnessHash ());
481
495
auto it_grandchild = submit_spend_ignored.m_tx_results .find (ptx_grandchild->GetWitnessHash ());
482
496
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)
577
591
{
578
592
const auto mixed_result = ProcessNewPackage (m_node.chainman ->ActiveChainstate (), *m_node.mempool , package_mixed, false );
579
593
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 ());
580
595
auto it_parent1 = mixed_result.m_tx_results .find (ptx_parent1->GetWitnessHash ());
581
596
auto it_parent2 = mixed_result.m_tx_results .find (ptx_parent2_v1->GetWitnessHash ());
582
597
auto it_parent3 = mixed_result.m_tx_results .find (ptx_parent3->GetWitnessHash ());
@@ -648,6 +663,7 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
648
663
BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
649
664
const auto submit_cpfp_deprio = ProcessNewPackage (m_node.chainman ->ActiveChainstate (), *m_node.mempool ,
650
665
package_cpfp, /* test_accept=*/ false );
666
+ BOOST_CHECK_EQUAL (submit_cpfp_deprio.m_state .GetResult (), PackageValidationResult::PCKG_POLICY);
651
667
BOOST_CHECK_MESSAGE (submit_cpfp_deprio.m_state .IsInvalid (),
652
668
" Package validation unexpectedly succeeded: " << submit_cpfp_deprio.m_state .GetRejectReason ());
653
669
BOOST_CHECK (submit_cpfp_deprio.m_tx_results .empty ());
@@ -667,6 +683,7 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
667
683
expected_pool_size += 2 ;
668
684
BOOST_CHECK_MESSAGE (submit_cpfp.m_state .IsValid (),
669
685
" Package validation unexpectedly failed: " << submit_cpfp.m_state .GetRejectReason ());
686
+ BOOST_CHECK_EQUAL (submit_cpfp.m_tx_results .size (), package_cpfp.size ());
670
687
auto it_parent = submit_cpfp.m_tx_results .find (tx_parent->GetWitnessHash ());
671
688
auto it_child = submit_cpfp.m_tx_results .find (tx_child->GetWitnessHash ());
672
689
BOOST_CHECK (it_parent != submit_cpfp.m_tx_results .end ());
@@ -736,6 +753,7 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
736
753
" Package validation unexpectedly failed" << submit_prioritised_package.m_state .GetRejectReason ());
737
754
const CFeeRate expected_feerate (1 * COIN + 200 ,
738
755
GetVirtualTransactionSize (*tx_parent_cheap) + GetVirtualTransactionSize (*tx_child_cheap));
756
+ BOOST_CHECK_EQUAL (submit_prioritised_package.m_tx_results .size (), package_still_too_low.size ());
739
757
auto it_parent = submit_prioritised_package.m_tx_results .find (tx_parent_cheap->GetWitnessHash ());
740
758
auto it_child = submit_prioritised_package.m_tx_results .find (tx_child_cheap->GetWitnessHash ());
741
759
BOOST_CHECK (it_parent != submit_prioritised_package.m_tx_results .end ());
0 commit comments