Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 371 Lines • ▼ Show 20 Lines | |||||
void UnloadBlockIndex(); | void UnloadBlockIndex(); | ||||
/** | /** | ||||
* Run an instance of the script checking thread. | * Run an instance of the script checking thread. | ||||
*/ | */ | ||||
void ThreadScriptCheck(int worker_num); | void ThreadScriptCheck(int worker_num); | ||||
/** | /** | ||||
* Check whether we are doing an initial block download (synchronizing from disk | |||||
* or network) | |||||
*/ | |||||
bool IsInitialBlockDownload(); | |||||
/** | |||||
* Retrieve a transaction (from memory pool, or from disk, if possible). | * Retrieve a transaction (from memory pool, or from disk, if possible). | ||||
*/ | */ | ||||
bool GetTransaction(const TxId &txid, CTransactionRef &txOut, | bool GetTransaction(const TxId &txid, CTransactionRef &txOut, | ||||
const Consensus::Params ¶ms, BlockHash &hashBlock, | const Consensus::Params ¶ms, BlockHash &hashBlock, | ||||
bool fAllowSlow = false, | bool fAllowSlow = false, | ||||
const CBlockIndex *const blockIndex = nullptr); | const CBlockIndex *const blockIndex = nullptr); | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 368 Lines • ▼ Show 20 Lines | private: | ||||
* well. | * well. | ||||
* | * | ||||
* Because we already walk mapBlockIndex in height-order at startup, we go | * Because we already walk mapBlockIndex in height-order at startup, we go | ||||
* ahead and mark descendants of invalid blocks as FAILED_CHILD at that | * ahead and mark descendants of invalid blocks as FAILED_CHILD at that | ||||
* time, instead of putting things in this set. | * time, instead of putting things in this set. | ||||
*/ | */ | ||||
std::set<CBlockIndex *> m_failed_blocks; | std::set<CBlockIndex *> m_failed_blocks; | ||||
/** | |||||
* Whether this chainstate is undergoing initial block download. | |||||
* | |||||
* Mutable because we need to be able to mark IsInitialBlockDownload() | |||||
* const, which latches this for caching purposes. | |||||
*/ | |||||
mutable std::atomic<bool> m_cached_finished_ibd{false}; | |||||
public: | public: | ||||
CChain m_chain; | CChain m_chain; | ||||
BlockMap mapBlockIndex GUARDED_BY(cs_main); | BlockMap mapBlockIndex GUARDED_BY(cs_main); | ||||
std::multimap<CBlockIndex *, CBlockIndex *> mapBlocksUnlinked; | std::multimap<CBlockIndex *, CBlockIndex *> mapBlocksUnlinked; | ||||
CBlockIndex *pindexBestInvalid = nullptr; | CBlockIndex *pindexBestInvalid = nullptr; | ||||
CBlockIndex *pindexBestParked = nullptr; | CBlockIndex *pindexBestParked = nullptr; | ||||
CBlockIndex const *pindexFinalized = nullptr; | CBlockIndex const *pindexFinalized = nullptr; | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | public: | ||||
bool ReplayBlocks(const Consensus::Params ¶ms, CCoinsView *view); | bool ReplayBlocks(const Consensus::Params ¶ms, CCoinsView *view); | ||||
bool LoadGenesisBlock(const CChainParams &chainparams); | bool LoadGenesisBlock(const CChainParams &chainparams); | ||||
void PruneBlockIndexCandidates(); | void PruneBlockIndexCandidates(); | ||||
void UnloadBlockIndex(); | void UnloadBlockIndex(); | ||||
/** | |||||
* Check whether we are doing an initial block download (synchronizing from | |||||
* disk or network) | |||||
*/ | |||||
bool IsInitialBlockDownload() const; | |||||
private: | private: | ||||
bool ActivateBestChainStep(const Config &config, CValidationState &state, | bool ActivateBestChainStep(const Config &config, CValidationState &state, | ||||
CBlockIndex *pindexMostWork, | CBlockIndex *pindexMostWork, | ||||
const std::shared_ptr<const CBlock> &pblock, | const std::shared_ptr<const CBlock> &pblock, | ||||
bool &fInvalidFound, ConnectTrace &connectTrace) | bool &fInvalidFound, ConnectTrace &connectTrace) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
bool ConnectTip(const Config &config, CValidationState &state, | bool ConnectTip(const Config &config, CValidationState &state, | ||||
CBlockIndex *pindexNew, | CBlockIndex *pindexNew, | ||||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |