diff --git a/src/bench/checkblock.cpp b/src/bench/checkblock.cpp index cbba543f2d8..9faf9ac137a 100644 --- a/src/bench/checkblock.cpp +++ b/src/bench/checkblock.cpp @@ -4,22 +4,14 @@ #include #include -#include -#include #include #include #include -#include -#include #include -#include #include #include #include -#include -#include -#include // These are the two major time-sinks which happen after we have fully received // a block off the wire, but before we can relay the block on to peers using @@ -27,27 +19,29 @@ static void DeserializeBlockTest(benchmark::Bench& bench) { - DataStream stream; - bench.unit("block").epochIterations(1) - .setup([&] { stream = DataStream{benchmark::data::block413567}; }) - .run([&] { CBlock block; stream >> TX_WITH_WITNESS(block); }); + const auto block_data{benchmark::data::block413567}; + bench.unit("block").run([&] { + CBlock block; + SpanReader{block_data} >> TX_WITH_WITNESS(block); + assert(block.vtx.size() == 1557); + }); } static void CheckBlockTest(benchmark::Bench& bench) { - ArgsManager bench_args; - const auto chainParams = CreateChainParams(bench_args, ChainType::MAIN); + const auto& chain_params{CChainParams::Main()}; + const auto block_data{benchmark::data::block413567}; CBlock block; bench.unit("block").epochIterations(1) .setup([&] { block = CBlock{}; - DataStream stream{benchmark::data::block413567}; - stream >> TX_WITH_WITNESS(block); + SpanReader{block_data} >> TX_WITH_WITNESS(block); + assert(block.vtx.size() == 1557); }) .run([&] { BlockValidationState validationState; - bool checked = CheckBlock(block, validationState, chainParams->GetConsensus()); + const bool checked{CheckBlock(block, validationState, chain_params->GetConsensus())}; assert(checked); }); }