Skip to content

Commit aecc332

Browse files
committed
create and use mempool transactions using real coins in MempoolCheck
1 parent 2118750 commit aecc332

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/bench/mempool_stress.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,15 @@ static void ComplexMemPool(benchmark::Bench& bench)
102102
static void MempoolCheck(benchmark::Bench& bench)
103103
{
104104
FastRandomContext det_rand{true};
105-
const int childTxs = bench.complexityN() > 1 ? static_cast<int>(bench.complexityN()) : 2000;
106-
const std::vector<CTransactionRef> ordered_coins = CreateOrderedCoins(det_rand, childTxs, /*min_ancestors=*/5);
107-
const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(CBaseChainParams::MAIN, {"-checkmempool=1"});
108-
CTxMemPool pool;
105+
auto testing_setup = MakeNoLogFileContext<TestChain100Setup>(CBaseChainParams::REGTEST, {"-checkmempool=1"});
106+
CTxMemPool& pool = *testing_setup.get()->m_node.mempool;
109107
LOCK2(cs_main, pool.cs);
108+
testing_setup->PopulateMempool(det_rand, 400, true);
110109
const CCoinsViewCache& coins_tip = testing_setup.get()->m_node.chainman->ActiveChainstate().CoinsTip();
111-
for (auto& tx : ordered_coins) AddTx(tx, pool);
112110

113111
bench.run([&]() NO_THREAD_SAFETY_ANALYSIS {
114-
pool.check(coins_tip, /*spendheight=*/2);
112+
// Bump up the spendheight so we don't hit premature coinbase spend errors.
113+
pool.check(coins_tip, /*spendheight=*/300);
115114
});
116115
}
117116

0 commit comments

Comments
 (0)