Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 720 Lines • ▼ Show 20 Lines | public: | ||||
//! All arguments forwarded onto CCoinsViewDB. | //! All arguments forwarded onto CCoinsViewDB. | ||||
CoinsViews(std::string ldb_name, size_t cache_size_bytes, bool in_memory, | CoinsViews(std::string ldb_name, size_t cache_size_bytes, bool in_memory, | ||||
bool should_wipe); | bool should_wipe); | ||||
//! Initialize the CCoinsViewCache member. | //! Initialize the CCoinsViewCache member. | ||||
void InitCache() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | void InitCache() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | ||||
}; | }; | ||||
enum class CoinsCacheSizeState { | |||||
//! The coins cache is in immediate need of a flush. | |||||
CRITICAL = 2, | |||||
//! The cache is at >= 90% capacity. | |||||
LARGE = 1, | |||||
OK = 0 | |||||
}; | |||||
/** | /** | ||||
* 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 | ||||
* current best chain. | * current best chain. | ||||
* | * | ||||
* Eventually, the API here is targeted at being exposed externally as a | * Eventually, the API here is targeted at being exposed externally as a | ||||
* consumable libconsensus library, so any functions added must only call | * consumable libconsensus library, so any functions added must only call | ||||
* other class member functions, pure functions in other parts of the consensus | * other class member functions, pure functions in other parts of the consensus | ||||
* library, callbacks via the validation interface, or read/write-to-disk | * library, callbacks via the validation interface, or read/write-to-disk | ||||
▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
void CheckBlockIndex(const Consensus::Params &consensusParams); | void CheckBlockIndex(const Consensus::Params &consensusParams); | ||||
/** Update the chain tip based on database information, i.e. CoinsTip()'s | /** Update the chain tip based on database information, i.e. CoinsTip()'s | ||||
* best block. */ | * best block. */ | ||||
bool LoadChainTip(const CChainParams &chainparams) | bool LoadChainTip(const CChainParams &chainparams) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
//! Dictates whether we need to flush the cache to disk or not. | |||||
//! | |||||
//! @return the state of the size of the coins cache. | |||||
CoinsCacheSizeState GetCoinsCacheSizeState(const CTxMemPool &tx_pool) | |||||
EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | |||||
CoinsCacheSizeState GetCoinsCacheSizeState( | |||||
const CTxMemPool &tx_pool, size_t max_coins_cache_size_bytes, | |||||
size_t max_mempool_size_bytes) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | |||||
std::string ToString() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | std::string ToString() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | ||||
private: | private: | ||||
bool ActivateBestChainStep(const Config &config, | bool ActivateBestChainStep(const Config &config, | ||||
BlockValidationState &state, | BlockValidationState &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) | ||||
▲ Show 20 Lines • Show All 294 Lines • Show Last 20 Lines |