| 103 | } |
| 104 | |
| 105 | static 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 | |
| 122 | BENCHMARK(ComplexMemPool); |
| 123 | BENCHMARK(MempoolCheck); |
nothing calls this directly
no test coverage detected