MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / RpcMempool

Function RpcMempool

src/bench/rpc_mempool.cpp:28–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28static void RpcMempool(benchmark::Bench& bench)
29{
30 const auto testing_setup = MakeNoLogFileContext<const ChainTestingSetup>(ChainType::MAIN);
31 CTxMemPool& pool = *Assert(testing_setup->m_node.mempool);
32 LOCK2(cs_main, pool.cs);
33
34 for (int i = 0; i < 1000; ++i) {
35 CMutableTransaction tx = CMutableTransaction();
36 tx.vin.resize(1);
37 tx.vin[0].scriptSig = CScript() << OP_1;
38 tx.vin[0].scriptWitness.stack.push_back({1});
39 tx.vout.resize(1);
40 tx.vout[0].scriptPubKey = CScript() << OP_1 << OP_EQUAL;
41 tx.vout[0].nValue = i;
42 const CTransactionRef tx_r{MakeTransactionRef(tx)};
43 AddTx(tx_r, /*fee=*/i, pool);
44 }
45
46 bench.run([&] {
47 (void)MempoolToJSON(pool, /*verbose=*/true);
48 });
49}
50
51BENCHMARK(RpcMempool);

Callers

nothing calls this directly

Calls 8

MakeTransactionRefFunction · 0.85
MempoolToJSONFunction · 0.85
AddTxFunction · 0.70
CMutableTransactionClass · 0.50
CScriptClass · 0.50
resizeMethod · 0.45
push_backMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected