MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / DeserializeAndCheckBlockTest

Function DeserializeAndCheckBlockTest

src/bench/checkblock.cpp:35–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35static void DeserializeAndCheckBlockTest(benchmark::State& state)
36{
37 CDataStream stream((const char*)block_bench::block413567,
38 (const char*)&block_bench::block413567[sizeof(block_bench::block413567)],
39 SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_BLOCK_LEGACY);
40 char a = '\0';
41 stream.write(&a, 1); // Prevent compaction
42
43 const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
44
45 while (state.KeepRunning()) {
46 CBlock block; // Note that CBlock caches its checked state, so we need to recreate it here
47 stream >> block;
48 assert(stream.Rewind(sizeof(block_bench::block413567)));
49
50 CValidationState validationState;
51 assert(CheckBlock(block, validationState, chainParams->GetConsensus()));
52 }
53}
54
55BENCHMARK(DeserializeBlockTest, 130);
56BENCHMARK(DeserializeAndCheckBlockTest, 160);

Callers

nothing calls this directly

Calls 5

CreateChainParamsFunction · 0.85
CheckBlockFunction · 0.85
KeepRunningMethod · 0.80
RewindMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected