MCPcopy Create free account
hub / github.com/ElementsProject/elements / MempoolCheck

Function MempoolCheck

src/bench/mempool_stress.cpp:105–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105static void MempoolCheck(benchmark::Bench& bench)
106{
107 FastRandomContext det_rand{true};
108 const int childTxs = bench.complexityN() > 1 ? static_cast<int>(bench.complexityN()) : 2000;
109 const std::vector<CTransactionRef> ordered_coins = CreateOrderedCoins(det_rand, childTxs, /* min_ancestors */ 5);
110 const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(CBaseChainParams::MAIN, {"-checkmempool=1"});
111 CTxMemPool pool;
112 LOCK2(cs_main, pool.cs);
113 const CBlockIndex* chain_tip = testing_setup.get()->m_node.chainman->ActiveChainstate().m_chain.Tip();
114 const CCoinsViewCache& coins_tip = testing_setup.get()->m_node.chainman->ActiveChainstate().CoinsTip();
115 for (auto& tx : ordered_coins) AddTx(tx, pool);
116
117 bench.run([&]() NO_THREAD_SAFETY_ANALYSIS {
118 pool.check(chain_tip, coins_tip, /* spendheight */ 2);
119 });
120}
121
122BENCHMARK(ComplexMemPool);
123BENCHMARK(MempoolCheck);

Callers

nothing calls this directly

Calls 7

CreateOrderedCoinsFunction · 0.85
AddTxFunction · 0.85
complexityNMethod · 0.80
TipMethod · 0.45
getMethod · 0.45
runMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected