| 102 | } |
| 103 | |
| 104 | void 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 | |
| 119 | static void ConnectBlockAllSchnorr(benchmark::Bench& bench) |
| 120 | { |
no test coverage detected