Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | |||||
* finalization. | * finalization. | ||||
* This value should be >> block propagation and validation time | * This value should be >> block propagation and validation time | ||||
*/ | */ | ||||
static const int64_t DEFAULT_MIN_FINALIZATION_DELAY = 2 * 60 * 60; | static const int64_t DEFAULT_MIN_FINALIZATION_DELAY = 2 * 60 * 60; | ||||
extern CScript COINBASE_FLAGS; | extern CScript COINBASE_FLAGS; | ||||
extern RecursiveMutex cs_main; | extern RecursiveMutex cs_main; | ||||
extern CTxMemPool g_mempool; | extern CTxMemPool g_mempool; | ||||
typedef std::unordered_map<BlockHash, CBlockIndex *, BlockHasher> BlockMap; | |||||
extern Mutex g_best_block_mutex; | extern Mutex g_best_block_mutex; | ||||
extern std::condition_variable g_best_block_cv; | extern std::condition_variable g_best_block_cv; | ||||
extern uint256 g_best_block; | extern uint256 g_best_block; | ||||
extern std::atomic_bool fImporting; | extern std::atomic_bool fImporting; | ||||
extern std::atomic_bool fReindex; | extern std::atomic_bool fReindex; | ||||
extern bool fRequireStandard; | extern bool fRequireStandard; | ||||
extern bool fCheckBlockIndex; | extern bool fCheckBlockIndex; | ||||
extern bool fCheckpointsEnabled; | extern bool fCheckpointsEnabled; | ||||
▲ Show 20 Lines • Show All 495 Lines • ▼ Show 20 Lines | public: | ||||
~CVerifyDB(); | ~CVerifyDB(); | ||||
bool VerifyDB(const Config &config, CCoinsView *coinsview, int nCheckLevel, | bool VerifyDB(const Config &config, CCoinsView *coinsview, int nCheckLevel, | ||||
int nCheckDepth); | int nCheckDepth); | ||||
}; | }; | ||||
/** Replay blocks that aren't fully applied to the database. */ | /** Replay blocks that aren't fully applied to the database. */ | ||||
bool ReplayBlocks(const Consensus::Params ¶ms, CCoinsView *view); | bool ReplayBlocks(const Consensus::Params ¶ms, CCoinsView *view); | ||||
CBlockIndex *LookupBlockIndex(const BlockHash &hash) | |||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | |||||
/** Find the last common block between the parameter chain and a locator. */ | /** Find the last common block between the parameter chain and a locator. */ | ||||
CBlockIndex *FindForkInGlobalIndex(const CChain &chain, | CBlockIndex *FindForkInGlobalIndex(const CChain &chain, | ||||
const CBlockLocator &locator) | const CBlockLocator &locator) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
/** @see CChainState::FlushStateToDisk */ | /** @see CChainState::FlushStateToDisk */ | ||||
enum class FlushStateMode { NONE, IF_NEEDED, PERIODIC, ALWAYS }; | enum class FlushStateMode { NONE, IF_NEEDED, PERIODIC, ALWAYS }; | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | CBlockIndex *AddToBlockIndex(const CBlockHeader &block) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
/** Create a new block index entry for a given block hash */ | /** Create a new block index entry for a given block hash */ | ||||
CBlockIndex *InsertBlockIndex(const BlockHash &hash) | CBlockIndex *InsertBlockIndex(const BlockHash &hash) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
/** | /** | ||||
* If a block header hasn't already been seen, call CheckBlockHeader on it, | * If a block header hasn't already been seen, call CheckBlockHeader on it, | ||||
* ensure that it doesn't descend from an invalid block, and then add it to | * ensure that it doesn't descend from an invalid block, and then add it to | ||||
* mapBlockIndex. | * m_block_index. | ||||
*/ | */ | ||||
bool AcceptBlockHeader(const Config &config, const CBlockHeader &block, | bool AcceptBlockHeader(const Config &config, const CBlockHeader &block, | ||||
BlockValidationState &state, CBlockIndex **ppindex) | BlockValidationState &state, CBlockIndex **ppindex) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
}; | }; | ||||
/** | /** | ||||
* CChainState stores and provides an API to update our local knowledge of the | * CChainState stores and provides an API to update our local knowledge of the | ||||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | bool IsBlockFinalized(const CBlockIndex *pindex) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
/** @returns the most-work valid chainstate. */ | /** @returns the most-work valid chainstate. */ | ||||
CChainState &ChainstateActive(); | CChainState &ChainstateActive(); | ||||
/** @returns the most-work chain. */ | /** @returns the most-work chain. */ | ||||
CChain &ChainActive(); | CChain &ChainActive(); | ||||
/** @returns the global block index map. */ | |||||
BlockMap &BlockIndex(); | |||||
/** | /** | ||||
* Global variable that points to the coins database (protected by cs_main) | * Global variable that points to the coins database (protected by cs_main) | ||||
*/ | */ | ||||
extern std::unique_ptr<CCoinsViewDB> pcoinsdbview; | extern std::unique_ptr<CCoinsViewDB> pcoinsdbview; | ||||
/** | /** | ||||
* Global variable that points to the active CCoinsView (protected by cs_main) | * Global variable that points to the active CCoinsView (protected by cs_main) | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |