| 29 | } |
| 30 | |
| 31 | static void DeserializeAndCheckBlockTest(benchmark::Bench& bench) |
| 32 | { |
| 33 | CDataStream stream(benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION); |
| 34 | std::byte a{0}; |
| 35 | stream.write({&a, 1}); // Prevent compaction |
| 36 | |
| 37 | ArgsManager bench_args; |
| 38 | const auto chainParams = CreateChainParams(bench_args, CBaseChainParams::MAIN); |
| 39 | |
| 40 | bench.unit("block").run([&] { |
| 41 | CBlock block; // Note that CBlock caches its checked state, so we need to recreate it here |
| 42 | stream >> block; |
| 43 | bool rewound = stream.Rewind(benchmark::data::block413567.size()); |
| 44 | assert(rewound); |
| 45 | |
| 46 | BlockValidationState validationState; |
| 47 | bool checked = CheckBlock(block, validationState, chainParams->GetConsensus()); |
| 48 | assert(checked); |
| 49 | }); |
| 50 | } |
| 51 | |
| 52 | BENCHMARK(DeserializeBlockTest); |
| 53 | BENCHMARK(DeserializeAndCheckBlockTest); |
nothing calls this directly
no test coverage detected