Changeset View
Changeset View
Standalone View
Standalone View
src/bench/mempool_stress.cpp
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | static void MempoolCheck(benchmark::Bench &bench) { | ||||
const int childTxs = | const int childTxs = | ||||
bench.complexityN() > 1 ? static_cast<int>(bench.complexityN()) : 2000; | bench.complexityN() > 1 ? static_cast<int>(bench.complexityN()) : 2000; | ||||
const std::vector<CTransactionRef> ordered_coins = | const std::vector<CTransactionRef> ordered_coins = | ||||
CreateOrderedCoins(det_rand, childTxs, /* min_ancestors */ 5); | CreateOrderedCoins(det_rand, childTxs, /* min_ancestors */ 5); | ||||
const auto testing_setup = | const auto testing_setup = | ||||
TestingSetup(CBaseChainParams::MAIN, {"-checkmempool=1"}); | TestingSetup(CBaseChainParams::MAIN, {"-checkmempool=1"}); | ||||
CTxMemPool pool; | CTxMemPool pool; | ||||
LOCK2(cs_main, pool.cs); | LOCK2(cs_main, pool.cs); | ||||
const CCoinsViewCache &coins_tip = | |||||
testing_setup.m_node.chainman->ActiveChainstate().CoinsTip(); | |||||
for (auto &tx : ordered_coins) { | for (auto &tx : ordered_coins) { | ||||
AddTx(tx, pool); | AddTx(tx, pool); | ||||
} | } | ||||
bench.run([&]() NO_THREAD_SAFETY_ANALYSIS { | bench.run([&]() NO_THREAD_SAFETY_ANALYSIS { | ||||
pool.check(testing_setup.m_node.chainman->ActiveChainstate()); | pool.check(coins_tip, /* spendheight */ 2); | ||||
}); | }); | ||||
} | } | ||||
BENCHMARK(ComplexMemPool); | BENCHMARK(ComplexMemPool); | ||||
BENCHMARK(MempoolCheck); | BENCHMARK(MempoolCheck); |