5#ifndef BITCOIN_TEST_UTIL_CHAINSTATE_H
6#define BITCOIN_TEST_UTIL_CHAINSTATE_H
17#include <boost/test/unit_test.hpp>
25template<
typename F = decltype(NoMalleation)>
39 "Wrote UTXO snapshot to " <<
fs::PathToString(snapshot_path.make_preferred()) <<
": " << result.
write());
46 auto_infile >> metadata;
48 malleation(auto_infile, metadata);
50 return node.chainman->ActivateSnapshot(auto_infile, metadata,
true);
UniValue CreateUTXOSnapshot(NodeContext &node, CChainState &chainstate, CAutoFile &afile)
Helper to create UTXO snapshots given a chainstate and a file handle.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
static bool CreateAndActivateUTXOSnapshot(NodeContext &node, const fs::path root, F malleation=NoMalleation)
Create and activate a UTXO snapshot, optionally providing a function to malleate the snapshot.
Non-refcounted RAII wrapper for FILE*.
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
Path class wrapper to prepare application code for transition from boost::filesystem library to std::...
static const int CLIENT_VERSION
bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
static std::string PathToString(const path &path)
Convert path object to byte string.
FILE * fopen(const fs::path &p, const char *mode)
NodeContext struct containing references to chain state and connection state.
#define WITH_LOCK(cs, code)
Run code while locking a mutex.