6#ifndef BITCOIN_NODE_UTXO_SNAPSHOT_H
7#define BITCOIN_NODE_UTXO_SNAPSHOT_H
54 uint64_t coins_count) :
59 template <
typename Stream>
68 template <
typename Stream>
74 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.");
81 throw std::ios_base::failure(
strprintf(
"Version of snapshot %s does not match any of the supported versions.", version));
87 if (!std::equal(message.begin(), message.end(),
m_network_magic.data())) {
89 if (metadata_network) {
93 throw std::ios_base::failure(
strprintf(
"The network of the snapshot (%s) does not match the network of this node (%s).", network_string, node_network_string));
95 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.
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
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)
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)
std::optional< fs::path > FindSnapshotChainstateDir(const fs::path &data_dir)
Return a path to the snapshot-based chainstate dir, if one exists.
#define EXCLUSIVE_LOCKS_REQUIRED(...)
static constexpr std::array< uint8_t, 5 > SNAPSHOT_MAGIC_BYTES