Bitcoin ABC  0.26.3
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 
14 struct bilingual_str;
15 class Config;
16 class ChainstateManager;
17 class CTxMemPool;
18 namespace Consensus {
19 struct Params;
20 } // namespace Consensus
21 
22 namespace node {
23 
24 struct CacheSizes;
25 
27  CTxMemPool *mempool{nullptr};
29  bool coins_db_in_memory{false};
30  bool reindex{false};
31  bool reindex_chainstate{false};
32  bool prune{false};
36  std::function<bool()> check_interrupt;
37  std::function<void()> coins_error_cb;
38 };
39 
45  SUCCESS,
47  FAILURE,
53 };
54 
56 using ChainstateLoadResult = std::tuple<ChainstateLoadStatus, bilingual_str>;
57 
73  const CacheSizes &cache_sizes,
74  const ChainstateLoadOptions &options);
75 
78  const ChainstateLoadOptions &options);
79 } // namespace node
80 
81 #endif // BITCOIN_NODE_CHAINSTATE_H
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:19
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:209
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:1153
Definition: config.h:19
Definition: init.h:28
ChainstateLoadStatus
Chainstate load status.
Definition: chainstate.h:44
@ 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:56
ChainstateLoadResult LoadChainstate(ChainstateManager &chainman, const CacheSizes &cache_sizes, const ChainstateLoadOptions &options)
This sequence can have 4 types of outcomes:
Definition: chainstate.cpp:167
ChainstateLoadResult VerifyLoadedChainstate(ChainstateManager &chainman, const ChainstateLoadOptions &options)
Definition: chainstate.cpp:262
Bilingual messages:
Definition: translation.h:17
std::function< void()> coins_error_cb
Definition: chainstate.h:37
std::function< bool()> check_interrupt
Definition: chainstate.h:36
static constexpr int DEFAULT_CHECKLEVEL
Definition: validation.h:96
static const signed int DEFAULT_CHECKBLOCKS
Definition: validation.h:95