mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-02 03:31:35 +02:00
Fix BlockToJsonVerbose benchmark
Currently it was not possible to run just the BlockToJsonVerboes benchmarsk because it did not set up everything it needed, running `bench_bitcoin -filter=BlockToJsonVerbose` caused this assert to fail: ``` bench_bitcoin: chainparams.cpp:506: const CChainParams& Params(): Assertion `globalChainParams' failed. ``` Initializing TestingSetup fixes this.
This commit is contained in:
@ -7,12 +7,15 @@
|
|||||||
|
|
||||||
#include <rpc/blockchain.h>
|
#include <rpc/blockchain.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
|
#include <test/util/setup_common.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
|
|
||||||
static void BlockToJsonVerbose(benchmark::Bench& bench)
|
static void BlockToJsonVerbose(benchmark::Bench& bench)
|
||||||
{
|
{
|
||||||
|
TestingSetup test_setup{};
|
||||||
|
|
||||||
CDataStream stream(benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION);
|
CDataStream stream(benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION);
|
||||||
char a = '\0';
|
char a = '\0';
|
||||||
stream.write(&a, 1); // Prevent compaction
|
stream.write(&a, 1); // Prevent compaction
|
||||||
|
Reference in New Issue
Block a user