Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 832 Lines • ▼ Show 20 Lines | private: | ||||
/** | /** | ||||
* The best finalized block. | * The best finalized block. | ||||
* This block cannot be reorged in any way except by explicit user action. | * This block cannot be reorged in any way except by explicit user action. | ||||
*/ | */ | ||||
const CBlockIndex *m_finalizedBlockIndex GUARDED_BY(cs_main) = nullptr; | const CBlockIndex *m_finalizedBlockIndex GUARDED_BY(cs_main) = nullptr; | ||||
public: | public: | ||||
CChainState(BlockManager &blockman) : m_blockman(blockman) {} | explicit CChainState(BlockManager &blockman) : m_blockman(blockman) {} | ||||
CChainState(); | explicit CChainState(BlockHash from_snapshot_blockhash = BlockHash()); | ||||
/** | /** | ||||
* Initialize the CoinsViews UTXO set database management data structures. | * Initialize the CoinsViews UTXO set database management data structures. | ||||
* The in-memory cache is initialized separately. | * The in-memory cache is initialized separately. | ||||
* | * | ||||
* All parameters forwarded to CoinsViews. | * All parameters forwarded to CoinsViews. | ||||
*/ | */ | ||||
void InitCoinsDB(size_t cache_size_bytes, bool in_memory, bool should_wipe, | void InitCoinsDB(size_t cache_size_bytes, bool in_memory, bool should_wipe, | ||||
std::string leveldb_name = "chainstate"); | std::string leveldb_name = "chainstate"); | ||||
//! Initialize the in-memory coins cache (to be done after the health of the | //! Initialize the in-memory coins cache (to be done after the health of the | ||||
//! on-disk database is verified). | //! on-disk database is verified). | ||||
void InitCoinsCache() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | void InitCoinsCache() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | ||||
//! @returns whether or not the CoinsViews object has been fully initialized | //! @returns whether or not the CoinsViews object has been fully initialized | ||||
//! and we can | //! and we can | ||||
//! safely flush this object to disk. | //! safely flush this object to disk. | ||||
bool CanFlushToDisk() EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | bool CanFlushToDisk() EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | ||||
return m_coins_views && m_coins_views->m_cacheview; | return m_coins_views && m_coins_views->m_cacheview; | ||||
} | } | ||||
//! The current chain of blockheaders we consult and build on. | //! The current chain of blockheaders we consult and build on. | ||||
//! @see CChain, CBlockIndex. | //! @see CChain, CBlockIndex. | ||||
CChain m_chain; | CChain m_chain; | ||||
/** | |||||
* The blockhash which is the base of the snapshot this chainstate was | |||||
* created from. | |||||
* | |||||
* IsNull() if this chainstate was not created from a snapshot. | |||||
*/ | |||||
const BlockHash m_from_snapshot_blockhash{}; | |||||
/** | /** | ||||
* The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for | * The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for | ||||
* itself and all ancestors) and as good as our current tip or better. | * itself and all ancestors) and as good as our current tip or better. | ||||
* Entries may be failed, though, and pruning nodes may be missing the data | * Entries may be failed, though, and pruning nodes may be missing the data | ||||
* for the block. | * for the block. | ||||
*/ | */ | ||||
std::set<CBlockIndex *, CBlockIndexWorkComparator> setBlockIndexCandidates; | std::set<CBlockIndex *, CBlockIndexWorkComparator> setBlockIndexCandidates; | ||||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |