diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-07-01 21:42:22 +0100 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-07-02 18:11:15 +0100 |
commit | 3d60a03a7cfb2d46b5f10633e9f6a9a36b8cb76f (patch) | |
tree | c9331766a3fa5b11dba590a0f968f36472e6a1c0 /src/bench/checkblock.cpp | |
parent | 3077f11dadffbc8f2575449fc0177c91a9c3e046 (diff) |
bench: Move generated data to a dedicated translation unit
Diffstat (limited to 'src/bench/checkblock.cpp')
-rw-r--r-- | src/bench/checkblock.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/bench/checkblock.cpp b/src/bench/checkblock.cpp index e325333c01..4b13381e16 100644 --- a/src/bench/checkblock.cpp +++ b/src/bench/checkblock.cpp @@ -3,41 +3,34 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <bench/bench.h> +#include <bench/data.h> #include <chainparams.h> #include <validation.h> #include <streams.h> #include <consensus/validation.h> -namespace block_bench { -#include <bench/data/block413567.raw.h> -} // namespace block_bench - // 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 // compact block relay. static void DeserializeBlockTest(benchmark::State& state) { - CDataStream stream((const char*)block_bench::block413567, - (const char*)block_bench::block413567 + sizeof(block_bench::block413567), - SER_NETWORK, PROTOCOL_VERSION); + CDataStream stream(benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION); char a = '\0'; stream.write(&a, 1); // Prevent compaction while (state.KeepRunning()) { CBlock block; stream >> block; - bool rewound = stream.Rewind(sizeof(block_bench::block413567)); + bool rewound = stream.Rewind(benchmark::data::block413567.size()); assert(rewound); } } static void DeserializeAndCheckBlockTest(benchmark::State& state) { - CDataStream stream((const char*)block_bench::block413567, - (const char*)block_bench::block413567 + sizeof(block_bench::block413567), - SER_NETWORK, PROTOCOL_VERSION); + CDataStream stream(benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION); char a = '\0'; stream.write(&a, 1); // Prevent compaction @@ -46,7 +39,7 @@ static void DeserializeAndCheckBlockTest(benchmark::State& state) while (state.KeepRunning()) { CBlock block; // Note that CBlock caches its checked state, so we need to recreate it here stream >> block; - bool rewound = stream.Rewind(sizeof(block_bench::block413567)); + bool rewound = stream.Rewind(benchmark::data::block413567.size()); assert(rewound); CValidationState validationState; |