For MempoolCheck
, it seems that the intention was to have a mempool with check_ratio = 1
(see -checkmempool=1
):
However in the subsequent line in the above snippet, a CTxMemPool
gets constructed with no arguments, which means that check_ratio
will default to 0:
Manually specifying check_ratio
to 1 (according to the original intention) and running the MempoolCheck
benchmark results in an assertion error:
0diff --git a/src/bench/mempool_stress.cpp b/src/bench/mempool_stress.cpp
1index afa4618e1b..32cdb70539 100644
2--- a/src/bench/mempool_stress.cpp
3+++ b/src/bench/mempool_stress.cpp
4@@ -105,7 +105,7 @@ static void MempoolCheck(benchmark::Bench& bench)
5 const int childTxs = bench.complexityN() > 1 ? static_cast<int>(bench.complexityN()) : 2000;
6 const std::vector<CTransactionRef> ordered_coins = CreateOrderedCoins(det_rand, childTxs, /* min_ancestors */ 5);
7 const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(CBaseChainParams::MAIN, {"-checkmempool=1"});
8- CTxMemPool pool;
9+ CTxMemPool pool{nullptr, 1};
10 LOCK2(cs_main, pool.cs);
11 const CCoinsViewCache& coins_tip = testing_setup.get()->m_node.chainman->ActiveChainstate().CoinsTip();
12 for (auto& tx : ordered_coins) AddTx(tx, pool);
0$ ./src/bench/bench_bitcoin -filter='MempoolCheck'
1...
2bench_bitcoin: txmempool.cpp:759: void CTxMemPool::check(const CCoinsViewCache &, int64_t) const: Assertion `mempoolDuplicate.HaveCoin(txin.prevout)' failed.
Aside from this problem, we should also probably just re-use the CTxMemPool
in TestingSetup
.
Ping @glozow