mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Improve block validity/ConnectBlock() comments
Previously didn't make clear that the ContextualCheckBlock* functions meant the block headers as context - not the UTXO set itself - and that ConnectBlock() also did UTXO-related validity checks (in the future we may split that functionality into a separate UTXO-specific contextual check block function). Also, reordered to put validity checks first for better readability.
This commit is contained in:
parent
a6771fc973
commit
2f19905324
26
src/main.h
26
src/main.h
@ -395,23 +395,27 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex, const Consensus
|
|||||||
|
|
||||||
/** Functions for validating blocks and updating the block tree */
|
/** Functions for validating blocks and updating the block tree */
|
||||||
|
|
||||||
|
/** Context-independent validity checks */
|
||||||
|
bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW = true);
|
||||||
|
bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
|
||||||
|
|
||||||
|
/** Context-dependent validity checks.
|
||||||
|
* By "context", we mean only the previous block headers, but not the UTXO
|
||||||
|
* set; UTXO-related validity checks are done in ConnectBlock(). */
|
||||||
|
bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex *pindexPrev);
|
||||||
|
bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex *pindexPrev);
|
||||||
|
|
||||||
|
/** Apply the effects of this block (with given index) on the UTXO set represented by coins.
|
||||||
|
* Validity checks that depend on the UTXO set are also done; ConnectBlock()
|
||||||
|
* can fail if those validity checks fail (among other reasons). */
|
||||||
|
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, bool fJustCheck = false);
|
||||||
|
|
||||||
/** Undo the effects of this block (with given index) on the UTXO set represented by coins.
|
/** Undo the effects of this block (with given index) on the UTXO set represented by coins.
|
||||||
* In case pfClean is provided, operation will try to be tolerant about errors, and *pfClean
|
* In case pfClean is provided, operation will try to be tolerant about errors, and *pfClean
|
||||||
* will be true if no problems were found. Otherwise, the return value will be false in case
|
* will be true if no problems were found. Otherwise, the return value will be false in case
|
||||||
* of problems. Note that in any case, coins may be modified. */
|
* of problems. Note that in any case, coins may be modified. */
|
||||||
bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockIndex* pindex, CCoinsViewCache& coins, bool* pfClean = NULL);
|
bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockIndex* pindex, CCoinsViewCache& coins, bool* pfClean = NULL);
|
||||||
|
|
||||||
/** Apply the effects of this block (with given index) on the UTXO set represented by coins */
|
|
||||||
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, bool fJustCheck = false);
|
|
||||||
|
|
||||||
/** Context-independent validity checks */
|
|
||||||
bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW = true);
|
|
||||||
bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
|
|
||||||
|
|
||||||
/** Context-dependent validity checks */
|
|
||||||
bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex *pindexPrev);
|
|
||||||
bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex *pindexPrev);
|
|
||||||
|
|
||||||
/** Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held) */
|
/** Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held) */
|
||||||
bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
|
bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user