aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-03-22 15:03:13 -0400
committerCarl Dong <contact@carldong.me>2022-06-15 17:28:55 -0400
commitd273e53b6e2cabd91a83f0ff0f9b6cfe1815b637 (patch)
treebda1d64ce6f60a658d8bd3e174f1801295f9bcaa /src/bench
parent020caba3df727ae8ede50eace86ae76971c0fea1 (diff)
downloadbitcoin-d273e53b6e2cabd91a83f0ff0f9b6cfe1815b637.tar.xz
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
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/rpc_mempool.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bench/rpc_mempool.cpp b/src/bench/rpc_mempool.cpp
index 6e322ba6aa..0e6fdae3d7 100644
--- a/src/bench/rpc_mempool.cpp
+++ b/src/bench/rpc_mempool.cpp
@@ -3,7 +3,9 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
+#include <chainparamsbase.h>
#include <rpc/mempool.h>
+#include <test/util/setup_common.h>
#include <txmempool.h>
#include <univalue.h>
@@ -17,7 +19,8 @@ static void AddTx(const CTransactionRef& tx, const CAmount& fee, CTxMemPool& poo
static void RpcMempool(benchmark::Bench& bench)
{
- CTxMemPool pool;
+ const auto testing_setup = MakeNoLogFileContext<const ChainTestingSetup>(CBaseChainParams::MAIN);
+ CTxMemPool& pool = *Assert(testing_setup->m_node.mempool);
LOCK2(cs_main, pool.cs);
for (int i = 0; i < 1000; ++i) {