Changeset View
Changeset View
Standalone View
Standalone View
src/test/miner_tests.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
static CFeeRate blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE_PER_KB); | static CFeeRate blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE_PER_KB); | ||||
static BlockAssembler AssemblerForTest(const CChainParams ¶ms, | static BlockAssembler AssemblerForTest(const CChainParams ¶ms, | ||||
const CTxMemPool &mempool) { | const CTxMemPool &mempool) { | ||||
BlockAssembler::Options options; | BlockAssembler::Options options; | ||||
options.blockMinFeeRate = blockMinFeeRate; | options.blockMinFeeRate = blockMinFeeRate; | ||||
options.nBlockPriorityPercentage = 0; | |||||
return BlockAssembler(params, mempool, options); | return BlockAssembler(params, mempool, options); | ||||
} | } | ||||
static struct { | static struct { | ||||
uint8_t extranonce; | uint8_t extranonce; | ||||
uint32_t nonce; | uint32_t nonce; | ||||
} blockinfo[] = { | } blockinfo[] = { | ||||
{4, 0xa4a3e223}, {2, 0x15c32f9e}, {1, 0x0375b547}, {1, 0x7004a8a5}, | {4, 0xa4a3e223}, {2, 0x15c32f9e}, {1, 0x0375b547}, {1, 0x7004a8a5}, | ||||
Show All 37 Lines | static bool TestSequenceLocks(const CTransaction &tx, int flags) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | ||||
LOCK(::g_mempool.cs); | LOCK(::g_mempool.cs); | ||||
return CheckSequenceLocks(::g_mempool, tx, flags); | return CheckSequenceLocks(::g_mempool, 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. | |||||
static void TestPackageSelection(const CChainParams &chainparams, | static void TestPackageSelection(const CChainParams &chainparams, | ||||
const CScript &scriptPubKey, | const CScript &scriptPubKey, | ||||
const std::vector<CTransactionRef> &txFirst) | const std::vector<CTransactionRef> &txFirst) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main, ::g_mempool.cs) { | EXCLUSIVE_LOCKS_REQUIRED(cs_main, ::g_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 | ||||
▲ Show 20 Lines • Show All 677 Lines • Show Last 20 Lines |