3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
5
5
#include < bench/bench.h>
6
+ #include < bench/data.h>
6
7
7
8
#include < chainparams.h>
8
9
#include < validation.h>
9
10
#include < streams.h>
10
11
#include < consensus/validation.h>
11
12
12
- namespace block_bench {
13
- #include < bench/data/block413567.raw.h>
14
- } // namespace block_bench
15
-
16
13
// These are the two major time-sinks which happen after we have fully received
17
14
// a block off the wire, but before we can relay the block on to peers using
18
15
// compact block relay.
19
16
20
17
static void DeserializeBlockTest (benchmark::State& state)
21
18
{
22
- CDataStream stream ((const char *)block_bench::block413567,
23
- (const char *)block_bench::block413567 + sizeof (block_bench::block413567),
24
- SER_NETWORK, PROTOCOL_VERSION);
19
+ CDataStream stream (benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION);
25
20
char a = ' \0 ' ;
26
21
stream.write (&a, 1 ); // Prevent compaction
27
22
28
23
while (state.KeepRunning ()) {
29
24
CBlock block;
30
25
stream >> block;
31
- bool rewound = stream.Rewind (sizeof (block_bench:: block413567));
26
+ bool rewound = stream.Rewind (benchmark::data:: block413567. size ( ));
32
27
assert (rewound);
33
28
}
34
29
}
35
30
36
31
static void DeserializeAndCheckBlockTest (benchmark::State& state)
37
32
{
38
- CDataStream stream ((const char *)block_bench::block413567,
39
- (const char *)block_bench::block413567 + sizeof (block_bench::block413567),
40
- SER_NETWORK, PROTOCOL_VERSION);
33
+ CDataStream stream (benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION);
41
34
char a = ' \0 ' ;
42
35
stream.write (&a, 1 ); // Prevent compaction
43
36
@@ -46,7 +39,7 @@ static void DeserializeAndCheckBlockTest(benchmark::State& state)
46
39
while (state.KeepRunning ()) {
47
40
CBlock block; // Note that CBlock caches its checked state, so we need to recreate it here
48
41
stream >> block;
49
- bool rewound = stream.Rewind (sizeof (block_bench:: block413567));
42
+ bool rewound = stream.Rewind (benchmark::data:: block413567. size ( ));
50
43
assert (rewound);
51
44
52
45
CValidationState validationState;
0 commit comments