v30.3-roots.1 · Commit 3: [PATCH 03/68] feat(policy): preserve Roots relay and network controls on Core 30.3
src/test/miner_tests.cpp
Before: src/test/miner_tests.cpp · After: src/test/miner_tests.cpp
File metadata
index 94ade598439554ea579551a77f532edafac4ef48..08fc1227939bb56871206d54d46dab78f4ca7a0c 100644
Download original patch · Release notes
Diff rows 1–32 of 32. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/test/miner_tests.cpp
CHANGED
|
@@ -168,6 +168,15 @@ void MinerTestingSetup::TestPackageSelection(const CScript& scriptPubKey, const
|
|
| 168 |
BOOST_CHECK(block.vtx[2]->GetHash() == hashHighFeeTx);
|
| 169 |
BOOST_CHECK(block.vtx[3]->GetHash() == hashMediumFeeTx);
|
| 170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
// Test the inclusion of package feerates in the block template and ensure they are sequential.
|
| 172 |
const auto block_package_feerates = BlockAssembler{m_node.chainman->ActiveChainstate(), &tx_mempool, options}.CreateNewBlock()->m_package_feerates;
|
| 173 |
BOOST_CHECK(block_package_feerates.size() == 2);
|
|
@@ -243,7 +252,8 @@ void MinerTestingSetup::TestPackageSelection(const CScript& scriptPubKey, const
|
|
| 243 |
// This tx can't be mined by itself
|
| 244 |
tx.vin[0].prevout.hash = hashFreeTx2;
|
| 245 |
tx.vout.resize(1);
|
| 246 |
-
feeToUse = blockMinFeeRate.GetFee(freeTxSize);
|
|
|
|
| 247 |
tx.vout[0].nValue = 5000000000LL - 100000000 - feeToUse;
|
| 248 |
Txid hashLowFeeTx2 = tx.GetHash();
|
| 249 |
AddToMempool(tx_mempool, entry.Fee(feeToUse).SpendsCoinbase(false).FromTx(tx));
|
|
@@ -685,6 +695,8 @@ void MinerTestingSetup::TestPrioritisedMining(const CScript& scriptPubKey, const
|
|
| 685 |
// NOTE: These tests rely on CreateNewBlock doing its own self-validation!
|
| 686 |
BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
| 687 |
{
|
|
|
|
|
|
|
| 688 |
auto mining{MakeMining()};
|
| 689 |
BOOST_REQUIRE(mining);
|
| 690 |
|
|
|
|
| 168 |
BOOST_CHECK(block.vtx[2]->GetHash() == hashHighFeeTx);
|
| 169 |
BOOST_CHECK(block.vtx[3]->GetHash() == hashMediumFeeTx);
|
| 170 |
|
| 171 |
+
// The fee-selected parent/child package must also respect an explicit
|
| 172 |
+
// serialized-size cap. The default-weight template above remains free to
|
| 173 |
+
// include the same package.
|
| 174 |
+
BlockAssembler::Options size_limited_options{options};
|
| 175 |
+
size_limited_options.nBlockMaxSize = DEFAULT_BLOCK_RESERVED_SIZE + ::GetSerializeSize(TX_WITH_WITNESS(parent_tx.GetTx()));
|
| 176 |
+
const auto size_limited_block = BlockAssembler{m_node.chainman->ActiveChainstate(), &tx_mempool, size_limited_options}.CreateNewBlock();
|
| 177 |
+
BOOST_REQUIRE(size_limited_block);
|
| 178 |
+
BOOST_CHECK_EQUAL(size_limited_block->block.vtx.size(), 1U);
|
| 179 |
+
|
| 180 |
// Test the inclusion of package feerates in the block template and ensure they are sequential.
|
| 181 |
const auto block_package_feerates = BlockAssembler{m_node.chainman->ActiveChainstate(), &tx_mempool, options}.CreateNewBlock()->m_package_feerates;
|
| 182 |
BOOST_CHECK(block_package_feerates.size() == 2);
|
|
|
|
| 252 |
// This tx can't be mined by itself
|
| 253 |
tx.vin[0].prevout.hash = hashFreeTx2;
|
| 254 |
tx.vout.resize(1);
|
| 255 |
+
const size_t lowFeeTx2VSize = GetVirtualTransactionSize(CTransaction{tx});
|
| 256 |
+
feeToUse = blockMinFeeRate.GetFee(lowFeeTx2VSize);
|
| 257 |
tx.vout[0].nValue = 5000000000LL - 100000000 - feeToUse;
|
| 258 |
Txid hashLowFeeTx2 = tx.GetHash();
|
| 259 |
AddToMempool(tx_mempool, entry.Fee(feeToUse).SpendsCoinbase(false).FromTx(tx));
|
|
|
|
| 695 |
// NOTE: These tests rely on CreateNewBlock doing its own self-validation!
|
| 696 |
BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
| 697 |
{
|
| 698 |
+
gArgs.ForceSetArg("-blockprioritysize", "0");
|
| 699 |
+
|
| 700 |
auto mining{MakeMining()};
|
| 701 |
BOOST_REQUIRE(mining);
|
| 702 |
|