Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 1,109 Lines • ▼ Show 20 Lines | public: | ||||
CChainState & | CChainState & | ||||
InitializeChainstate(const BlockHash &snapshot_blockhash = BlockHash()) | InitializeChainstate(const BlockHash &snapshot_blockhash = BlockHash()) | ||||
EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | ||||
//! Get all chainstates currently being used. | //! Get all chainstates currently being used. | ||||
std::vector<CChainState *> GetAll(); | std::vector<CChainState *> GetAll(); | ||||
//! The most-work chain. | //! The most-work chain. | ||||
CChain &ActiveChain() const; | CChainState &ActiveChainstate() const; | ||||
CChain &ActiveChain() const { return ActiveChainstate().m_chain; } | |||||
int ActiveHeight() const { return ActiveChain().Height(); } | int ActiveHeight() const { return ActiveChain().Height(); } | ||||
CBlockIndex *ActiveTip() const { return ActiveChain().Tip(); } | CBlockIndex *ActiveTip() const { return ActiveChain().Tip(); } | ||||
BlockMap &BlockIndex() EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { | BlockMap &BlockIndex() EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { | ||||
return m_blockman.m_block_index; | return m_blockman.m_block_index; | ||||
} | } | ||||
bool IsSnapshotActive() const; | bool IsSnapshotActive() const; | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
/** | /** | ||||
* DEPRECATED! Please use node.chainman instead. May only be used in | * DEPRECATED! Please use node.chainman instead. May only be used in | ||||
* validation.cpp internally | * validation.cpp internally | ||||
*/ | */ | ||||
extern ChainstateManager g_chainman GUARDED_BY(::cs_main); | extern ChainstateManager g_chainman GUARDED_BY(::cs_main); | ||||
/** @returns the most-work valid chainstate. */ | /** Please prefer the identical ChainstateManager::ActiveChainstate */ | ||||
CChainState &ChainstateActive(); | CChainState &ChainstateActive(); | ||||
/** @returns the most-work chain. */ | /** Please prefer the identical ChainstateManager::ActiveChain */ | ||||
CChain &ChainActive(); | CChain &ChainActive(); | ||||
/** @returns the global block index map. */ | /** Please prefer the identical ChainstateManager::BlockIndex */ | ||||
BlockMap &BlockIndex(); | BlockMap &BlockIndex(); | ||||
/** | /** | ||||
* Global variable that points to the active block tree (protected by cs_main) | * Global variable that points to the active block tree (protected by cs_main) | ||||
*/ | */ | ||||
extern std::unique_ptr<CBlockTreeDB> pblocktree; | extern std::unique_ptr<CBlockTreeDB> pblocktree; | ||||
/** | /** | ||||
Show All 26 Lines |