diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include index be8864076c..1bc2d9a340 100644 --- a/src/Makefile.bench.include +++ b/src/Makefile.bench.include @@ -7,7 +7,7 @@ BENCH_SRCDIR = bench BENCH_BINARY = bench/bench_unite$(EXEEXT) RAW_BENCH_FILES = \ - bench/data/block413567.raw + bench/data/test_block.raw GENERATED_BENCH_FILES = $(RAW_BENCH_FILES:.raw=.raw.h) bench_bench_unite_SOURCES = \ @@ -70,7 +70,7 @@ CLEAN_UNITE_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_BENCH_FILES) CLEANFILES += $(CLEAN_UNITE_BENCH) -bench/checkblock.cpp: bench/data/block413567.raw.h +bench/checkblock.cpp: bench/data/test_block.raw.h unite_bench: $(BENCH_BINARY) diff --git a/src/bench/checkblock.cpp b/src/bench/checkblock.cpp index 124da1a0b8..c119f1661c 100644 --- a/src/bench/checkblock.cpp +++ b/src/bench/checkblock.cpp @@ -10,7 +10,7 @@ #include namespace block_bench { -#include +#include } // namespace block_bench // These are the two major time-sinks which happen after we have fully received @@ -19,8 +19,8 @@ namespace block_bench { static void DeserializeBlockTest(benchmark::State& state) { - CDataStream stream((const char*)block_bench::block413567, - (const char*)&block_bench::block413567[sizeof(block_bench::block413567)], + CDataStream stream((const char*)block_bench::test_block, + (const char*)&block_bench::test_block[sizeof(block_bench::test_block)], SER_NETWORK, PROTOCOL_VERSION); char a = '\0'; stream.write(&a, 1); // Prevent compaction @@ -28,24 +28,25 @@ static void DeserializeBlockTest(benchmark::State& state) while (state.KeepRunning()) { CBlock block; stream >> block; - assert(stream.Rewind(sizeof(block_bench::block413567))); + assert(stream.Rewind(sizeof(block_bench::test_block))); } } static void DeserializeAndCheckBlockTest(benchmark::State& state) { - CDataStream stream((const char*)block_bench::block413567, - (const char*)&block_bench::block413567[sizeof(block_bench::block413567)], + // UNIT-E TODO: This is a synthetic block, it makes sense to change it to a real block later on. + CDataStream stream((const char*)block_bench::test_block, + (const char*)&block_bench::test_block[sizeof(block_bench::test_block)], SER_NETWORK, PROTOCOL_VERSION); char a = '\0'; stream.write(&a, 1); // Prevent compaction - const auto chainParams = CreateChainParams(CBaseChainParams::TESTNET); + const auto chainParams = CreateChainParams(CBaseChainParams::REGTEST); while (state.KeepRunning()) { CBlock block; // Note that CBlock caches its checked state, so we need to recreate it here stream >> block; - assert(stream.Rewind(sizeof(block_bench::block413567))); + assert(stream.Rewind(sizeof(block_bench::test_block))); CValidationState validationState; assert(CheckBlock(block, validationState, chainParams->GetConsensus())); diff --git a/src/bench/data/test_block.raw b/src/bench/data/test_block.raw new file mode 100644 index 0000000000..69faaa6391 Binary files /dev/null and b/src/bench/data/test_block.raw differ