Bitcoin ABC 0.34.2
P2P Digital Currency
chainstate.h
Go to the documentation of this file.
1// Copyright (c) 2021 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_NODE_CHAINSTATE_H
6#define BITCOIN_NODE_CHAINSTATE_H
7
8#include <validation.h>
9
10#include <cstdint>
11#include <functional>
12#include <optional>
13
14struct bilingual_str;
15class Config;
17class CTxMemPool;
18namespace Consensus {
19struct Params;
20} // namespace Consensus
21
22namespace kernel {
23struct CacheSizes;
24} // namespace kernel
25
26namespace node {
27
31 bool coins_db_in_memory{false};
32 // Whether to wipe the block tree database when loading it. If set, this
33 // will also set a reindexing flag so any existing block data files will be
34 // scanned and added to the database.
35 bool wipe_block_tree_db{false};
36 // Whether to wipe the chainstate database when loading it. If set, this
37 // will cause the chainstate database to be rebuilt starting from genesis.
38 bool wipe_chainstate_db{false};
39 bool prune{false};
43 std::function<bool()> check_interrupt;
44 std::function<void()> coins_error_cb;
45};
46
52 SUCCESS,
54 FAILURE,
60};
61
63using ChainstateLoadResult = std::tuple<ChainstateLoadStatus, bilingual_str>;
64
80 const kernel::CacheSizes &cache_sizes,
81 const ChainstateLoadOptions &options);
82
85 const ChainstateLoadOptions &options);
86} // namespace node
87
88#endif // BITCOIN_NODE_CHAINSTATE_H
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:21
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:222
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:1176
Definition: config.h:19
Definition: init.h:28
Definition: messages.h:12
ChainstateLoadStatus
Chainstate load status.
Definition: chainstate.h:51
@ FAILURE_FATAL
Fatal error which should not prompt to reindex.
@ FAILURE
Generic failure which reindexing may fix.
std::tuple< ChainstateLoadStatus, bilingual_str > ChainstateLoadResult
Chainstate load status code and optional error string.
Definition: chainstate.h:63
ChainstateLoadResult LoadChainstate(ChainstateManager &chainman, const CacheSizes &cache_sizes, const ChainstateLoadOptions &options)
Definition: chainstate.cpp:172
ChainstateLoadResult VerifyLoadedChainstate(ChainstateManager &chainman, const ChainstateLoadOptions &options)
Definition: chainstate.cpp:276
Bilingual messages:
Definition: translation.h:17
std::function< void()> coins_error_cb
Definition: chainstate.h:44
std::function< bool()> check_interrupt
Definition: chainstate.h:43
static constexpr int DEFAULT_CHECKLEVEL
Definition: validation.h:92
static const signed int DEFAULT_CHECKBLOCKS
Definition: validation.h:91