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

Function BenchmarkConnectBlock

src/bench/connectblock.cpp:104–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void BenchmarkConnectBlock(benchmark::Bench& bench, std::vector<CKey>& keys, std::vector<CTxOut>& outputs, TestChain100Setup& test_setup)
105{
106 const auto& test_block{CreateTestBlock(test_setup, keys, outputs)};
107 bench.unit("block").run([&] {
108 LOCK(cs_main);
109 auto& chainman{test_setup.m_node.chainman};
110 auto& chainstate{chainman->ActiveChainstate()};
111 BlockValidationState test_block_state;
112 auto* pindex{chainman->m_blockman.AddToBlockIndex(test_block, chainman->m_best_header)}; // Doing this here doesn't impact the benchmark
113 CCoinsViewCache viewNew{&chainstate.CoinsTip()};
114
115 assert(chainstate.ConnectBlock(test_block, test_block_state, pindex, viewNew));
116 });
117}
118
119static void ConnectBlockAllSchnorr(benchmark::Bench& bench)
120{

Callers 3

ConnectBlockAllSchnorrFunction · 0.85
ConnectBlockAllEcdsaFunction · 0.85

Calls 4

AddToBlockIndexMethod · 0.80
ConnectBlockMethod · 0.80
CreateTestBlockFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected