Merge #20998: test: Fix BlockToJsonVerbose benchmark

7487bc9900d28e1b5361cba882fd8783aafc7092 Fix BlockToJsonVerbose benchmark (Martin Ankerl)

Pull request description:

  Currently it was not possible to run just the BlockToJsonVerbose benchmark 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.

ACKs for top commit:
  theStack:
    Tested ACK 7487bc9900d28e1b5361cba882fd8783aafc7092 🐎

Tree-SHA512: 27b9702cb4bacc0475710f7b31f41844e83b8a0787685380749505d179aba724728604d4e4e2e3b3cb38cde88ab12f170881b5d3eb615872ee84632e85312166
This commit is contained in:
MarcoFalke 2021-01-25 08:42:33 +01:00 committed by pasta
parent d40ac79d4d
commit 0aab5fc5ac
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -10,11 +10,14 @@
#include <llmq/instantsend.h> #include <llmq/instantsend.h>
#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::block813851, SER_NETWORK, PROTOCOL_VERSION); CDataStream stream(benchmark::data::block813851, SER_NETWORK, PROTOCOL_VERSION);
char a = '\0'; char a = '\0';
stream.write(&a, 1); // Prevent compaction stream.write(&a, 1); // Prevent compaction