Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
| Show First 20 Lines • Show All 326 Lines • ▼ Show 20 Lines | |||||
| * block index object for the given headers. | * block index object for the given headers. | ||||
| * @return True if block headers were accepted as valid. | * @return True if block headers were accepted as valid. | ||||
| */ | */ | ||||
| bool ProcessNewBlockHeaders(const Config &config, | bool ProcessNewBlockHeaders(const Config &config, | ||||
| const std::vector<CBlockHeader> &block, | const std::vector<CBlockHeader> &block, | ||||
| CValidationState &state, | CValidationState &state, | ||||
| const CBlockIndex **ppindex = nullptr); | const CBlockIndex **ppindex = nullptr); | ||||
| /** Check whether enough disk space is available for an incoming block */ | /** | ||||
| * Check whether enough disk space is available for an incoming block. | |||||
| */ | |||||
| bool CheckDiskSpace(uint64_t nAdditionalBytes = 0); | bool CheckDiskSpace(uint64_t nAdditionalBytes = 0); | ||||
| /** Open a block file (blk?????.dat) */ | |||||
| /** | |||||
| * Open a block file (blk?????.dat). | |||||
| */ | |||||
| FILE *OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly = false); | FILE *OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly = false); | ||||
| /** Translation to a filesystem path */ | |||||
| /** | |||||
| * Translation to a filesystem path. | |||||
| */ | |||||
| fs::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix); | fs::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix); | ||||
| /** Import blocks from an external file */ | |||||
| /** | |||||
| * Import blocks from an external file. | |||||
| */ | |||||
| bool LoadExternalBlockFile(const Config &config, FILE *fileIn, | bool LoadExternalBlockFile(const Config &config, FILE *fileIn, | ||||
| CDiskBlockPos *dbp = nullptr); | CDiskBlockPos *dbp = nullptr); | ||||
| /** Initialize a new block tree database + block data on disk */ | |||||
| /** | |||||
| * Initialize a new block tree database + block data on disk. | |||||
| */ | |||||
| bool InitBlockIndex(const Config &config); | bool InitBlockIndex(const Config &config); | ||||
| /** Load the block tree and coins database from disk */ | |||||
| /** | |||||
| * Load the block tree and coins database from disk. | |||||
| */ | |||||
| bool LoadBlockIndex(const CChainParams &chainparams); | bool LoadBlockIndex(const CChainParams &chainparams); | ||||
| /** Update the chain tip based on database information. */ | |||||
| /** | |||||
| * Update the chain tip based on database information. | |||||
| */ | |||||
| void LoadChainTip(const CChainParams &chainparams); | void LoadChainTip(const CChainParams &chainparams); | ||||
| /** Unload database information */ | |||||
| /** | |||||
| * Unload database information. | |||||
| */ | |||||
| void UnloadBlockIndex(); | void UnloadBlockIndex(); | ||||
| /** Run an instance of the script checking thread */ | |||||
| /** | |||||
| * Run an instance of the script checking thread. | |||||
| */ | |||||
| void ThreadScriptCheck(); | void ThreadScriptCheck(); | ||||
| /** Check whether we are doing an initial block download (synchronizing from | |||||
| * disk or network) */ | /** | ||||
| * Check whether we are doing an initial block download (synchronizing from disk | |||||
| * or network) | |||||
| */ | |||||
| bool IsInitialBlockDownload(); | bool IsInitialBlockDownload(); | ||||
| /** Format a string that describes several potential problems detected by the | |||||
| /** | |||||
| * Format a string that describes several potential problems detected by the | |||||
| * core. | * core. | ||||
| * strFor can have three values: | * strFor can have three values: | ||||
| * - "rpc": get critical warnings, which should put the client in safe mode if | * - "rpc": get critical warnings, which should put the client in safe mode if | ||||
| * non-empty | * non-empty | ||||
| * - "statusbar": get all warnings | * - "statusbar": get all warnings | ||||
| * - "gui": get all warnings, translated (where possible) for GUI | * - "gui": get all warnings, translated (where possible) for GUI | ||||
| * This function only returns the highest priority warning of the set selected | * This function only returns the highest priority warning of the set selected | ||||
| * by strFor. | * by strFor. | ||||
| */ | */ | ||||
| std::string GetWarnings(const std::string &strFor); | std::string GetWarnings(const std::string &strFor); | ||||
| /** 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 Config &config, const uint256 &hash, | bool GetTransaction(const Config &config, const uint256 &hash, | ||||
| CTransactionRef &tx, uint256 &hashBlock, | CTransactionRef &tx, uint256 &hashBlock, | ||||
| bool fAllowSlow = false); | bool fAllowSlow = false); | ||||
| /** | /** | ||||
| * Find the best known block, and make it the active tip of the block chain. | * Find the best known block, and make it the active tip of the block chain. | ||||
| * If it fails, the tip is not updated. | * If it fails, the tip is not updated. | ||||
| * | * | ||||
| * pblock is either nullptr or a pointer to a block that is already loaded | * pblock is either nullptr or a pointer to a block that is already loaded | ||||
| * in memory (to avoid loading it from disk again). | * in memory (to avoid loading it from disk again). | ||||
| * | * | ||||
| * Returns true if a new chain tip was set. | * Returns true if a new chain tip was set. | ||||
| */ | */ | ||||
| bool ActivateBestChain( | bool ActivateBestChain( | ||||
| const Config &config, CValidationState &state, | const Config &config, CValidationState &state, | ||||
| std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>()); | std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>()); | ||||
| Amount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams); | Amount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams); | ||||
| /** Guess verification progress (as a fraction between 0.0=genesis and | /** | ||||
| * 1.0=current tip). */ | * Guess verification progress (as a fraction between 0.0=genesis and | ||||
| * 1.0=current tip). | |||||
| */ | |||||
| double GuessVerificationProgress(const ChainTxData &data, CBlockIndex *pindex); | double GuessVerificationProgress(const ChainTxData &data, CBlockIndex *pindex); | ||||
| /** | /** | ||||
| * Mark one block file as pruned. | * Mark one block file as pruned. | ||||
| */ | */ | ||||
| void PruneOneBlockFile(const int fileNumber); | void PruneOneBlockFile(const int fileNumber); | ||||
| /** | /** | ||||
| * Actually unlink the specified files | * Actually unlink the specified files | ||||
| */ | */ | ||||
| void UnlinkPrunedFiles(const std::set<int> &setFilesToPrune); | void UnlinkPrunedFiles(const std::set<int> &setFilesToPrune); | ||||
| /** Create a new block index entry for a given block hash */ | /** Create a new block index entry for a given block hash */ | ||||
| CBlockIndex *InsertBlockIndex(uint256 hash); | CBlockIndex *InsertBlockIndex(uint256 hash); | ||||
| /** Flush all state, indexes and buffers to disk. */ | /** Flush all state, indexes and buffers to disk. */ | ||||
| void FlushStateToDisk(); | void FlushStateToDisk(); | ||||
| /** Prune block files and flush state to disk. */ | /** Prune block files and flush state to disk. */ | ||||
| ▲ Show 20 Lines • Show All 323 Lines • Show Last 20 Lines | |||||