doc: Add docstrings for ConnectBlock and SpendBlock

This commit is contained in:
TheCharlatan 2025-04-21 21:36:56 +02:00
parent 8221e89ac4
commit 76a8f22c5c
No known key found for this signature in database
GPG key ID: 9B79B45691DB4173

View file

@ -706,9 +706,34 @@ public:
// Block (dis)connection on a given view:
DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex* pindex, CCoinsViewCache& view)
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
/**
* Validates the block against the coins in the blockundo data, writes the
* undo data, and raises the block validity in the block index.
*
* @param[in] block The block to be validated
* @param[in] block_hash Hash of block
* @param[in] blockundo Has to contain all coins spent by block. Written to disk on successful validation
* @param[out] state This may be set to an Error state if any error occurred validating block
* @param[out] pindex Points to the block map entry associated with block. On successful validation, raises the block validity
* @param[in] fJustCheck If set, no data is written to disk and pindex's validity is not raised
*/
bool ConnectBlock(const CBlock& block, const uint256& block_hash, const CBlockUndo& blockundo, BlockValidationState& state,
CBlockIndex* pindex, bool fJustCheck = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
/**
* Spends the coins associated with a block. First checks that the block
* contains no duplicate transactions (BIP30), then for each transaction in
* the block checks that the outputs it is spending exist, spends them, and
* populates the CBlockUndo data structure.
*
* @param[in] block The block to be spent
* @param[in] pindex Points to the block map entry associated with block
* @param[in] block_hash Hash of block
* @param[out] view Its coins are spent and used to populate CBlockUndo during its execution
* @param[out] state This may be set to an Error state if any error occurred processing them
* @param[out] blockundo Coins consumed by the block are added to it.
*/
bool SpendBlock(const CBlock& block, const CBlockIndex* pindex, const uint256& block_hash,
CCoinsViewCache& view, BlockValidationState& state, CBlockUndo& blockundo) EXCLUSIVE_LOCKS_REQUIRED(cs_main);