Bitcoin Core  26.1.0
P2P Digital Currency
chainstate.h
Go to the documentation of this file.
1 // Copyright (c) 2021-2022 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 <util/translation.h>
9 #include <validation.h>
10 
11 #include <cstdint>
12 #include <functional>
13 #include <tuple>
14 
15 class CTxMemPool;
16 
17 namespace node {
18 
19 struct CacheSizes;
20 
22  CTxMemPool* mempool{nullptr};
24  bool coins_db_in_memory{false};
25  bool reindex{false};
26  bool reindex_chainstate{false};
27  bool prune{false};
35  std::function<bool()> check_interrupt;
36  std::function<void()> coins_error_cb;
37 };
38 
44  SUCCESS,
45  FAILURE,
50 };
51 
53 using ChainstateLoadResult = std::tuple<ChainstateLoadStatus, bilingual_str>;
54 
69  const ChainstateLoadOptions& options);
71 } // namespace node
72 
73 #endif // BITCOIN_NODE_CHAINSTATE_H
ChainstateLoadResult VerifyLoadedChainstate(ChainstateManager &chainman, const ChainstateLoadOptions &options)
Definition: chainstate.cpp:246
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:827
static constexpr int DEFAULT_CHECKLEVEL
Definition: validation.h:75
Fatal error which should not prompt to reindex.
ChainstateLoadStatus
Chainstate load status.
Definition: chainstate.h:43
std::function< bool()> check_interrupt
Definition: chainstate.h:35
bool require_full_verification
Setting require_full_verification to true will require all checks at check_level (below) to succeed f...
Definition: chainstate.h:32
Definition: init.h:25
std::function< void()> coins_error_cb
Definition: chainstate.h:36
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:301
static const signed int DEFAULT_CHECKBLOCKS
Definition: validation.h:74
Generic failure which reindexing may fix.
std::tuple< ChainstateLoadStatus, bilingual_str > ChainstateLoadResult
Chainstate load status code and optional error string.
Definition: chainstate.h:53
ChainstateLoadResult LoadChainstate(ChainstateManager &chainman, const CacheSizes &cache_sizes, const ChainstateLoadOptions &options)
This sequence can have 4 types of outcomes:
Definition: chainstate.cpp:161