6#ifndef BITCOIN_NODE_UTXO_SNAPSHOT_H
7#define BITCOIN_NODE_UTXO_SNAPSHOT_H
63 template <
typename Stream>
72 template <
typename Stream>
78 throw std::ios_base::failure(
"Invalid UTXO set snapshot magic bytes. Please check if this is indeed a snapshot file or if you are using an outdated snapshot format.");
85 throw std::ios_base::failure(
strprintf(
"Version of snapshot %s does not match any of the supported versions.", version));
91 if (!std::equal(message.begin(), message.end(),
m_network_magic.data())) {
99 throw std::ios_base::failure(
"This snapshot has been created for an unrecognized network. This could be a custom signet, a new testnet or possibly caused by data corruption.");
std::string ChainTypeToString(ChainType chain)
Chainstate stores and provides an API to update our local knowledge of the current best chain.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
std::optional< ChainType > GetNetworkForMagic(const MessageStartChars &message)
std::array< uint8_t, 4 > MessageStartChars
const fs::path SNAPSHOT_BLOCKHASH_FILENAME
The file in the snapshot chainstate dir which stores the base blockhash.
bool WriteSnapshotBaseBlockhash(Chainstate &snapshot_chainstate)
std::optional< fs::path > FindAssumeutxoChainstateDir(const fs::path &data_dir)
Return a path to the snapshot-based chainstate dir, if one exists.
bool WriteSnapshotBaseBlockhash(Chainstate &snapshot_chainstate) EXCLUSIVE_LOCKS_REQUIRED(std::optional< uint256 > ReadSnapshotBaseBlockhash(fs::path chaindir) EXCLUSIVE_LOCKS_REQUIRED(constexpr std::string_view SNAPSHOT_CHAINSTATE_SUFFIX
Write out the blockhash of the snapshot base block that was used to construct this chainstate.
std::optional< uint256 > ReadSnapshotBaseBlockhash(fs::path chaindir)
#define EXCLUSIVE_LOCKS_REQUIRED(...)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
constexpr std::array< uint8_t, 5 > SNAPSHOT_MAGIC_BYTES