7#include <chainparams.h>
8#include <test/util/setup_common.h>
25 const auto testing_setup{
30 const fs::path blkfile{testing_setup.get()->m_path_root /
"blk.dat"};
32 auto params{testing_setup->m_node.chainman->GetParams()};
33 ss << params.DiskMagic();
46 if (fwrite(ss.
data(), 1, ss.
size(), file) != ss.
size()) {
47 throw std::runtime_error(
"write to test file failed\n");
53 Chainstate &chainstate{testing_setup->m_node.chainman->ActiveChainstate()};
54 std::multimap<BlockHash, FlatFilePos> blocks_with_unknown_parent;
60 chainstate.LoadExternalBlockFile(file, &pos,
61 &blocks_with_unknown_parent);
static const std::string MAIN
BIP70 chain name strings (main, test or regtest)
Double ended buffer combining vector and stream-like interfaces.
void write(Span< const value_type > src)
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Main entry point to nanobench's benchmarking facility.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
BENCHMARK(LoadExternalBlockFile)
static void LoadExternalBlockFile(benchmark::Bench &bench)
The LoadExternalBlockFile() function is used during -reindex and -loadblock.
const std::vector< uint8_t > block413567
FILE * fopen(const fs::path &p, const char *mode)
static const unsigned int MAX_BLOCKFILE_SIZE
The maximum size of a blk?????.dat file (since 0.8)
Span< const std::byte > MakeByteSpan(V &&v) noexcept