Skip to content

Commit d273e53

Browse files
committed
bench/rpc_mempool: Create ChainTestingSetup, use its CTxMemPool
This is correct because: - The ChainTestingSetup is constructed before the call to bench.run(...) - All the runs are performed on the same mempool
1 parent 020caba commit d273e53

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bench/rpc_mempool.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <bench/bench.h>
6+
#include <chainparamsbase.h>
67
#include <rpc/mempool.h>
8+
#include <test/util/setup_common.h>
79
#include <txmempool.h>
810

911
#include <univalue.h>
@@ -17,7 +19,8 @@ static void AddTx(const CTransactionRef& tx, const CAmount& fee, CTxMemPool& poo
1719

1820
static void RpcMempool(benchmark::Bench& bench)
1921
{
20-
CTxMemPool pool;
22+
const auto testing_setup = MakeNoLogFileContext<const ChainTestingSetup>(CBaseChainParams::MAIN);
23+
CTxMemPool& pool = *Assert(testing_setup->m_node.mempool);
2124
LOCK2(cs_main, pool.cs);
2225

2326
for (int i = 0; i < 1000; ++i) {

0 commit comments

Comments
 (0)