Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 570 Lines • ▼ Show 20 Lines | |||||
* databases. | * databases. | ||||
*/ | */ | ||||
class CVerifyDB { | class CVerifyDB { | ||||
public: | public: | ||||
CVerifyDB(); | CVerifyDB(); | ||||
~CVerifyDB(); | ~CVerifyDB(); | ||||
[[nodiscard]] VerifyDBResult | [[nodiscard]] VerifyDBResult VerifyDB(Chainstate &chainstate, | ||||
VerifyDB(Chainstate &chainstate, const Config &config, | CCoinsView &coinsview, | ||||
CCoinsView &coinsview, int nCheckLevel, int nCheckDepth) | int nCheckLevel, int nCheckDepth) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
}; | }; | ||||
/** @see Chainstate::FlushStateToDisk */ | /** @see Chainstate::FlushStateToDisk */ | ||||
enum class FlushStateMode { NONE, IF_NEEDED, PERIODIC, ALWAYS }; | enum class FlushStateMode { NONE, IF_NEEDED, PERIODIC, ALWAYS }; | ||||
/** | /** | ||||
* A convenience class for constructing the CCoinsView* hierarchy used | * A convenience class for constructing the CCoinsView* hierarchy used | ||||
▲ Show 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | public: | ||||
* | * | ||||
* @param[in] fileIn FILE handle to file containing blocks to read | * @param[in] fileIn FILE handle to file containing blocks to read | ||||
* @param[in] dbp (optional) Disk block position (only for reindex) | * @param[in] dbp (optional) Disk block position (only for reindex) | ||||
* @param[in,out] blocks_with_unknown_parent | * @param[in,out] blocks_with_unknown_parent | ||||
* (optional) Map of disk positions for blocks with | * (optional) Map of disk positions for blocks with | ||||
* unknown parent, key is parent block hash | * unknown parent, key is parent block hash | ||||
* (only used for reindex) | * (only used for reindex) | ||||
*/ | */ | ||||
void LoadExternalBlockFile( | void LoadExternalBlockFile(FILE *fileIn, FlatFilePos *dbp = nullptr, | ||||
const Config &config, FILE *fileIn, FlatFilePos *dbp = nullptr, | std::multimap<BlockHash, FlatFilePos> | ||||
std::multimap<BlockHash, FlatFilePos> *blocks_with_unknown_parent = | *blocks_with_unknown_parent = nullptr) | ||||
nullptr) EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex, | EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex, | ||||
!cs_avalancheFinalizedBlockIndex); | !cs_avalancheFinalizedBlockIndex); | ||||
/** | /** | ||||
* Update the on-disk chain state. | * Update the on-disk chain state. | ||||
* The caches and indexes are flushed depending on the mode we're called | * The caches and indexes are flushed depending on the mode we're called | ||||
* with if they're too large, if it's been a while since the last write, or | * with if they're too large, if it's been a while since the last write, or | ||||
* always and in all cases if we're in prune mode and are deleting files. | * always and in all cases if we're in prune mode and are deleting files. | ||||
* | * | ||||
* If FlushStateMode::NONE is used, then FlushStateToDisk(...) won't do | * If FlushStateMode::NONE is used, then FlushStateToDisk(...) won't do | ||||
Show All 33 Lines | public: | ||||
* @returns true unless a system error occurred | * @returns true unless a system error occurred | ||||
*/ | */ | ||||
bool ActivateBestChain(BlockValidationState &state, | bool ActivateBestChain(BlockValidationState &state, | ||||
std::shared_ptr<const CBlock> pblock = nullptr) | std::shared_ptr<const CBlock> pblock = nullptr) | ||||
EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex, | EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex, | ||||
!cs_avalancheFinalizedBlockIndex) | !cs_avalancheFinalizedBlockIndex) | ||||
LOCKS_EXCLUDED(cs_main); | LOCKS_EXCLUDED(cs_main); | ||||
bool AcceptBlock(const Config &config, | bool AcceptBlock(const std::shared_ptr<const CBlock> &pblock, | ||||
const std::shared_ptr<const CBlock> &pblock, | |||||
BlockValidationState &state, bool fRequested, | BlockValidationState &state, bool fRequested, | ||||
const FlatFilePos *dbp, bool *fNewBlock, | const FlatFilePos *dbp, bool *fNewBlock, | ||||
bool min_pow_checked) EXCLUSIVE_LOCKS_REQUIRED(cs_main); | bool min_pow_checked) EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
// Block (dis)connection on a given view: | // Block (dis)connection on a given view: | ||||
DisconnectResult DisconnectBlock(const CBlock &block, | DisconnectResult DisconnectBlock(const CBlock &block, | ||||
const CBlockIndex *pindex, | const CBlockIndex *pindex, | ||||
CCoinsViewCache &view) | CCoinsViewCache &view) | ||||
▲ Show 20 Lines • Show All 582 Lines • Show Last 20 Lines |