5 #ifndef BITCOIN_TEST_UTIL_CHAINSTATE_H 6 #define BITCOIN_TEST_UTIL_CHAINSTATE_H 24 template<
typename F = decltype(NoMalleation)>
37 node,
node.chainman->ActiveChainstate(), auto_outfile, snapshot_path, snapshot_path);
46 auto_infile >> metadata;
48 malleation(auto_infile, metadata);
50 return node.chainman->ActivateSnapshot(auto_infile, metadata,
true);
54 #endif // BITCOIN_TEST_UTIL_CHAINSTATE_H FILE * fopen(const fs::path &p, const char *mode)
UniValue CreateUTXOSnapshot(NodeContext &node, Chainstate &chainstate, AutoFile &afile, const fs::path &path, const fs::path &temppath)
Helper to create UTXO snapshots given a chainstate and a file handle.
Non-refcounted RAII wrapper for FILE*.
NodeContext struct containing references to chain state and connection state.
static std::string PathToString(const path &path)
Convert path object to a byte string.
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
static path u8path(const std::string &utf8_str)
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
static bool CreateAndActivateUTXOSnapshot(node::NodeContext &node, const fs::path root, F malleation=NoMalleation)
Create and activate a UTXO snapshot, optionally providing a function to malleate the snapshot...