Changeset View
Changeset View
Standalone View
Standalone View
src/test/miner_tests.cpp
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | static bool TestSequenceLocks(const CTransaction &tx, int flags) | ||||
return CheckSequenceLocks(tx, flags); | return CheckSequenceLocks(tx, flags); | ||||
} | } | ||||
// Test suite for ancestor feerate transaction selection. | // Test suite for ancestor feerate transaction selection. | ||||
// Implemented as an additional function, rather than a separate test case, to | // Implemented as an additional function, rather than a separate test case, to | ||||
// allow reusing the blockchain created in CreateNewBlock_validity. | // allow reusing the blockchain created in CreateNewBlock_validity. | ||||
// Note that this test assumes blockprioritypercentage is 0. | // Note that this test assumes blockprioritypercentage is 0. | ||||
static void TestPackageSelection(const CChainParams &chainparams, | static void TestPackageSelection(const CChainParams &chainparams, | ||||
CScript scriptPubKey, | const CScript &scriptPubKey, | ||||
std::vector<CTransactionRef> &txFirst) { | const std::vector<CTransactionRef> &txFirst) | ||||
EXCLUSIVE_LOCKS_REQUIRED(::mempool.cs) { | |||||
// Test the ancestor feerate transaction selection. | // Test the ancestor feerate transaction selection. | ||||
TestMemPoolEntryHelper entry; | TestMemPoolEntryHelper entry; | ||||
// Test that a medium fee transaction will be selected after a higher fee | // Test that a medium fee transaction will be selected after a higher fee | ||||
// rate package with a low fee rate parent. | // rate package with a low fee rate parent. | ||||
CMutableTransaction tx; | CMutableTransaction tx; | ||||
tx.vin.resize(1); | tx.vin.resize(1); | ||||
tx.vin[0].scriptSig = CScript() << OP_1; | tx.vin[0].scriptSig = CScript() << OP_1; | ||||
▲ Show 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < sizeof(blockinfo) / sizeof(*blockinfo); ++i) { | ||||
} | } | ||||
std::shared_ptr<const CBlock> shared_pblock = | std::shared_ptr<const CBlock> shared_pblock = | ||||
std::make_shared<const CBlock>(*pblock); | std::make_shared<const CBlock>(*pblock); | ||||
BOOST_CHECK(ProcessNewBlock(config, shared_pblock, true, nullptr)); | BOOST_CHECK(ProcessNewBlock(config, shared_pblock, true, nullptr)); | ||||
pblock->hashPrevBlock = pblock->GetHash(); | pblock->hashPrevBlock = pblock->GetHash(); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
LOCK(::g_mempool.cs); | |||||
// Just to make sure we can still make simple blocks. | // Just to make sure we can still make simple blocks. | ||||
BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, g_mempool) | BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, g_mempool) | ||||
.CreateNewBlock(scriptPubKey)); | .CreateNewBlock(scriptPubKey)); | ||||
const Amount BLOCKSUBSIDY = 50 * COIN; | const Amount BLOCKSUBSIDY = 50 * COIN; | ||||
const Amount LOWFEE = CENT; | const Amount LOWFEE = CENT; | ||||
const Amount HIGHFEE = COIN; | const Amount HIGHFEE = COIN; | ||||
▲ Show 20 Lines • Show All 455 Lines • Show Last 20 Lines |