MCPcopy Create free account
hub / github.com/ElementsProject/elements / RpcMempool

Function RpcMempool

src/bench/rpc_mempool.cpp:19–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19static void RpcMempool(benchmark::Bench& bench)
20{
21 CTxMemPool pool;
22 LOCK2(cs_main, pool.cs);
23
24 for (int i = 0; i < 1000; ++i) {
25 CMutableTransaction tx = CMutableTransaction();
26 tx.vin.resize(1);
27 tx.vin[0].scriptSig = CScript() << OP_1;
28 tx.witness.vtxinwit.resize(1);
29 tx.witness.vtxinwit[0].scriptWitness.stack.push_back({1});
30 tx.vout.resize(1);
31 tx.vout[0].scriptPubKey = CScript() << OP_1 << OP_EQUAL;
32 tx.vout[0].nValue = i;
33 const CTransactionRef tx_r{MakeTransactionRef(tx)};
34 AddTx(tx_r, /* fee */ i, pool);
35 }
36
37 bench.run([&] {
38 (void)MempoolToJSON(pool, /*verbose*/ true);
39 });
40}
41
42BENCHMARK(RpcMempool);

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected