@@ -101,9 +101,6 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
101
101
BOOST_CHECK (it_child != result_parent_child.m_tx_results .end ());
102
102
BOOST_CHECK_MESSAGE (it_child->second .m_state .IsValid (),
103
103
" Package validation unexpectedly failed: " << it_child->second .m_state .GetRejectReason ());
104
- BOOST_CHECK (result_parent_child.m_package_feerate .has_value ());
105
- BOOST_CHECK (result_parent_child.m_package_feerate .value () ==
106
- CFeeRate (2 * COIN, GetVirtualTransactionSize (*tx_parent) + GetVirtualTransactionSize (*tx_child)));
107
104
BOOST_CHECK (it_child->second .m_effective_feerate .value ().GetFee (GetVirtualTransactionSize (*tx_child)) == COIN);
108
105
BOOST_CHECK_EQUAL (it_child->second .m_wtxids_fee_calculations .value ().size (), 1 );
109
106
BOOST_CHECK_EQUAL (it_child->second .m_wtxids_fee_calculations .value ().front (), tx_child->GetWitnessHash ());
@@ -118,7 +115,6 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
118
115
auto it_giant_tx = result_single_large.m_tx_results .find (giant_ptx->GetWitnessHash ());
119
116
BOOST_CHECK (it_giant_tx != result_single_large.m_tx_results .end ());
120
117
BOOST_CHECK_EQUAL (it_giant_tx->second .m_state .GetRejectReason (), " tx-size" );
121
- BOOST_CHECK (result_single_large.m_package_feerate == std::nullopt);
122
118
123
119
// Check that mempool size hasn't changed.
124
120
BOOST_CHECK_EQUAL (m_node.mempool ->size (), initialPoolSize);
@@ -239,7 +235,6 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
239
235
BOOST_CHECK_EQUAL (result_unrelated_submit.m_state .GetResult (), PackageValidationResult::PCKG_POLICY);
240
236
BOOST_CHECK_EQUAL (result_unrelated_submit.m_state .GetRejectReason (), " package-not-child-with-parents" );
241
237
BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
242
- BOOST_CHECK (result_unrelated_submit.m_package_feerate == std::nullopt);
243
238
244
239
// Parent and Child (and Grandchild) Package
245
240
Package package_parent_child;
@@ -281,7 +276,6 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
281
276
BOOST_CHECK_EQUAL (result_3gen_submit.m_state .GetResult (), PackageValidationResult::PCKG_POLICY);
282
277
BOOST_CHECK_EQUAL (result_3gen_submit.m_state .GetRejectReason (), " package-not-child-with-parents" );
283
278
BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
284
- BOOST_CHECK (result_3gen_submit.m_package_feerate == std::nullopt);
285
279
}
286
280
287
281
// Parent and child package where transactions are invalid for reasons other than fee and
@@ -314,8 +308,6 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
314
308
BOOST_CHECK_EQUAL (result_missing_parent.m_state .GetResult (), PackageValidationResult::PCKG_POLICY);
315
309
BOOST_CHECK_EQUAL (result_missing_parent.m_state .GetRejectReason (), " package-not-child-with-unconfirmed-parents" );
316
310
BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
317
-
318
- BOOST_CHECK (result_missing_parent.m_package_feerate == std::nullopt);
319
311
}
320
312
321
313
// Submit package with parent + child.
@@ -341,10 +333,6 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
341
333
BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
342
334
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Txid (tx_parent->GetHash ())));
343
335
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Txid (tx_child->GetHash ())));
344
-
345
- // Since both transactions have high feerates, they each passed validation individually.
346
- // Package validation was unnecessary, so there is no package feerate.
347
- BOOST_CHECK (submit_parent_child.m_package_feerate == std::nullopt);
348
336
}
349
337
350
338
// Already-in-mempool transactions should be detected and de-duplicated.
@@ -365,8 +353,6 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup)
365
353
BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
366
354
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Txid (tx_parent->GetHash ())));
367
355
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Txid (tx_child->GetHash ())));
368
-
369
- BOOST_CHECK (submit_deduped.m_package_feerate == std::nullopt);
370
356
}
371
357
}
372
358
@@ -442,11 +428,8 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
442
428
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Txid (ptx_child1->GetHash ())));
443
429
444
430
// Child2 would have been validated individually.
445
- BOOST_CHECK (submit_witness1.m_package_feerate == std::nullopt);
446
-
447
431
const auto submit_witness2 = ProcessNewPackage (m_node.chainman ->ActiveChainstate (), *m_node.mempool ,
448
432
{ptx_parent, ptx_child2}, /* test_accept=*/ false );
449
- BOOST_CHECK (submit_witness2.m_package_feerate == std::nullopt);
450
433
BOOST_CHECK_MESSAGE (submit_witness2.m_state .IsValid (),
451
434
" Package validation unexpectedly failed: " << submit_witness2.m_state .GetRejectReason ());
452
435
auto it_parent2_deduped = submit_witness2.m_tx_results .find (ptx_parent->GetWitnessHash ());
@@ -470,7 +453,6 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
470
453
auto it_child_dup = submit_segwit_dedup.m_tx_results .find (ptx_child1->GetWitnessHash ());
471
454
BOOST_CHECK (it_parent_dup->second .m_result_type == MempoolAcceptResult::ResultType::MEMPOOL_ENTRY);
472
455
BOOST_CHECK (it_child_dup->second .m_result_type == MempoolAcceptResult::ResultType::MEMPOOL_ENTRY);
473
- BOOST_CHECK (submit_witness2.m_package_feerate == std::nullopt);
474
456
}
475
457
476
458
// Try submitting Package1{child2, grandchild} where child2 is same-txid-different-witness as
@@ -505,9 +487,6 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
505
487
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Txid (ptx_child2->GetHash ())));
506
488
BOOST_CHECK (!m_node.mempool ->exists (GenTxid::Wtxid (ptx_child2->GetWitnessHash ())));
507
489
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Wtxid (ptx_grandchild->GetWitnessHash ())));
508
-
509
- // Since child2 is ignored, grandchild would be validated individually.
510
- BOOST_CHECK (submit_spend_ignored.m_package_feerate == std::nullopt);
511
490
}
512
491
513
492
// A package Package{parent1, parent2, parent3, child} where the parents are a mixture of
@@ -620,11 +599,7 @@ BOOST_FIXTURE_TEST_CASE(package_witness_swap_tests, TestChain100Setup)
620
599
BOOST_CHECK (m_node.mempool ->exists (GenTxid::Txid (ptx_mixed_child->GetHash ())));
621
600
622
601
// package feerate should include parent3 and child. It should not include parent1 or parent2_v1.
623
- BOOST_CHECK (mixed_result.m_package_feerate .has_value ());
624
602
const CFeeRate expected_feerate (1 * COIN, GetVirtualTransactionSize (*ptx_parent3) + GetVirtualTransactionSize (*ptx_mixed_child));
625
- BOOST_CHECK_MESSAGE (mixed_result.m_package_feerate .value () == expected_feerate,
626
- strprintf (" Expected package feerate %s, got %s" , expected_feerate.ToString (),
627
- mixed_result.m_package_feerate .value ().ToString ()));
628
603
BOOST_CHECK (it_parent3->second .m_effective_feerate .value () == expected_feerate);
629
604
BOOST_CHECK (it_child->second .m_effective_feerate .value () == expected_feerate);
630
605
std::vector<uint256> expected_wtxids ({ptx_parent3->GetWitnessHash (), ptx_mixed_child->GetWitnessHash ()});
@@ -678,11 +653,6 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
678
653
BOOST_CHECK (submit_cpfp_deprio.m_tx_results .empty ());
679
654
BOOST_CHECK_EQUAL (m_node.mempool ->size (), expected_pool_size);
680
655
const CFeeRate expected_feerate (0 , GetVirtualTransactionSize (*tx_parent) + GetVirtualTransactionSize (*tx_child));
681
- BOOST_CHECK (submit_cpfp_deprio.m_package_feerate .has_value ());
682
- BOOST_CHECK (submit_cpfp_deprio.m_package_feerate .value () == CFeeRate{0 });
683
- BOOST_CHECK_MESSAGE (submit_cpfp_deprio.m_package_feerate .value () == expected_feerate,
684
- strprintf (" Expected package feerate %s, got %s" , expected_feerate.ToString (),
685
- submit_cpfp_deprio.m_package_feerate .value ().ToString ()));
686
656
}
687
657
688
658
// Clear the prioritisation of the parent transaction.
@@ -718,10 +688,6 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
718
688
BOOST_CHECK (it_parent->second .m_wtxids_fee_calculations .value () == expected_wtxids);
719
689
BOOST_CHECK (it_child->second .m_wtxids_fee_calculations .value () == expected_wtxids);
720
690
BOOST_CHECK (expected_feerate.GetFeePerK () > 1000 );
721
- BOOST_CHECK (submit_cpfp.m_package_feerate .has_value ());
722
- BOOST_CHECK_MESSAGE (submit_cpfp.m_package_feerate .value () == expected_feerate,
723
- strprintf (" Expected package feerate %s, got %s" , expected_feerate.ToString (),
724
- submit_cpfp.m_package_feerate .value ().ToString ()));
725
691
}
726
692
727
693
// Just because we allow low-fee parents doesn't mean we allow low-feerate packages.
@@ -756,10 +722,6 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
756
722
const CFeeRate expected_feerate (200 ,
757
723
GetVirtualTransactionSize (*tx_parent_cheap) + GetVirtualTransactionSize (*tx_child_cheap));
758
724
BOOST_CHECK (expected_feerate.GetFeePerK () < 1000 );
759
- BOOST_CHECK (submit_package_too_low.m_package_feerate .has_value ());
760
- BOOST_CHECK_MESSAGE (submit_package_too_low.m_package_feerate .value () == expected_feerate,
761
- strprintf (" Expected package feerate %s, got %s" , expected_feerate.ToString (),
762
- submit_package_too_low.m_package_feerate .value ().ToString ()));
763
725
}
764
726
765
727
// Package feerate includes the modified fees of the transactions.
@@ -774,10 +736,6 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
774
736
" Package validation unexpectedly failed" << submit_prioritised_package.m_state .GetRejectReason ());
775
737
const CFeeRate expected_feerate (1 * COIN + 200 ,
776
738
GetVirtualTransactionSize (*tx_parent_cheap) + GetVirtualTransactionSize (*tx_child_cheap));
777
- BOOST_CHECK (submit_prioritised_package.m_package_feerate .has_value ());
778
- BOOST_CHECK_MESSAGE (submit_prioritised_package.m_package_feerate .value () == expected_feerate,
779
- strprintf (" Expected package feerate %s, got %s" , expected_feerate.ToString (),
780
- submit_prioritised_package.m_package_feerate .value ().ToString ()));
781
739
auto it_parent = submit_prioritised_package.m_tx_results .find (tx_parent_cheap->GetWitnessHash ());
782
740
auto it_child = submit_prioritised_package.m_tx_results .find (tx_child_cheap->GetWitnessHash ());
783
741
BOOST_CHECK (it_parent != submit_prioritised_package.m_tx_results .end ());
@@ -823,10 +781,6 @@ BOOST_FIXTURE_TEST_CASE(package_cpfp_tests, TestChain100Setup)
823
781
BOOST_CHECK_MESSAGE (submit_rich_parent.m_state .IsInvalid (), " Package validation unexpectedly succeeded" );
824
782
825
783
// The child would have been validated on its own and failed, then submitted as a "package" of 1.
826
- // The package feerate is just the child's feerate, which is 0sat/vb.
827
- BOOST_CHECK (submit_rich_parent.m_package_feerate .has_value ());
828
- BOOST_CHECK_MESSAGE (submit_rich_parent.m_package_feerate .value () == CFeeRate (),
829
- " expected 0, got " << submit_rich_parent.m_package_feerate .value ().ToString ());
830
784
BOOST_CHECK_EQUAL (submit_rich_parent.m_state .GetResult (), PackageValidationResult::PCKG_POLICY);
831
785
BOOST_CHECK_EQUAL (submit_rich_parent.m_state .GetRejectReason (), " package-fee-too-low" );
832
786
0 commit comments