Skip to content

Commit

Permalink
[0.22] Initialize base params on FEC benchmarking
Browse files Browse the repository at this point in the history
The FEC logic computes the memory-mapped FEC chunk storage filename
using gArgs.GetDataDirNet(). The latter, in turn, calls
ArgsManager::GetDataDir, which uses "BaseParams().DataDir()". But
BaseParams() needs globalChainBaseParams to be initialized, and that can
only hold if SelectParams() has been called before. This seems to be
required now, perhaps due to changes related to Bitcoin Core PR bitcoin#21005.
  • Loading branch information
blockstreamsatellite committed Oct 19, 2021
1 parent 41d9ef8 commit df33009
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bench/fec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include "consensus/merkle.h"
#include "fec.h"
#include "random.h"
#include "streams.h"
#include "txmempool.h"
#include "util/time.h"

#include "streams.h"
#include "version.h"
#include <chainparams.h>

#include <random>

Expand Down Expand Up @@ -274,6 +274,8 @@ static void FECEncodeAllBenchmark(benchmark::Bench& bench) { FECEncodeBenchmark(

static void FECDecodeBenchmark(benchmark::Bench& bench, unsigned mask, const MemoryUsageMode memory_usage_mode)
{
SelectParams(CBaseChainParams::REGTEST);

const auto& data = benchmark::data::block413567;
size_t fec_chunk_count = DIV_CEIL(data.size(), FEC_CHUNK_SIZE);
std::pair<std::unique_ptr<FECChunkType[]>, std::vector<uint32_t>> fec(std::piecewise_construct, std::forward_as_tuple(new FECChunkType[fec_chunk_count]), std::forward_as_tuple(fec_chunk_count));
Expand Down

0 comments on commit df33009

Please sign in to comment.