Documentation improvements for assumeutxo

This commit is contained in:
Ryan Ofsky
2023-06-16 20:42:24 -04:00
committed by Suhas Daftuar
parent 768690b7ce
commit 0ce805b632
2 changed files with 16 additions and 9 deletions

View File

@@ -17,10 +17,9 @@ respectively generate and load UTXO snapshots. The utility script
- A new block index `nStatus` flag is introduced, `BLOCK_ASSUMED_VALID`, to mark block - A new block index `nStatus` flag is introduced, `BLOCK_ASSUMED_VALID`, to mark block
index entries that are required to be assumed-valid by a chainstate created index entries that are required to be assumed-valid by a chainstate created
from a UTXO snapshot. This flag is mostly used as a way to modify certain from a UTXO snapshot. This flag is used as a way to modify certain
CheckBlockIndex() logic to account for index entries that are pending validation by a CheckBlockIndex() logic to account for index entries that are pending validation by a
chainstate running asynchronously in the background. We also use this flag to control chainstate running asynchronously in the background.
which index entries are added to setBlockIndexCandidates during LoadBlockIndex().
- The concept of UTXO snapshots is treated as an implementation detail that lives - The concept of UTXO snapshots is treated as an implementation detail that lives
behind the ChainstateManager interface. The external presentation of the changes behind the ChainstateManager interface. The external presentation of the changes

View File

@@ -113,10 +113,10 @@ enum BlockStatus : uint32_t {
BLOCK_VALID_TRANSACTIONS = 3, BLOCK_VALID_TRANSACTIONS = 3,
//! Outputs do not overspend inputs, no double spends, coinbase output ok, no immature coinbase spends, BIP30. //! Outputs do not overspend inputs, no double spends, coinbase output ok, no immature coinbase spends, BIP30.
//! Implies all parents are also at least CHAIN. //! Implies all parents are either at least VALID_CHAIN, or are ASSUMED_VALID
BLOCK_VALID_CHAIN = 4, BLOCK_VALID_CHAIN = 4,
//! Scripts & signatures ok. Implies all parents are also at least SCRIPTS. //! Scripts & signatures ok. Implies all parents are either at least VALID_SCRIPTS, or are ASSUMED_VALID.
BLOCK_VALID_SCRIPTS = 5, BLOCK_VALID_SCRIPTS = 5,
//! All validity bits. //! All validity bits.
@@ -134,10 +134,18 @@ enum BlockStatus : uint32_t {
BLOCK_OPT_WITNESS = 128, //!< block data in blk*.dat was received with a witness-enforcing client BLOCK_OPT_WITNESS = 128, //!< block data in blk*.dat was received with a witness-enforcing client
/** /**
* If set, this indicates that the block index entry is assumed-valid. * If ASSUMED_VALID is set, it means that this block has not been validated
* Certain diagnostics will be skipped in e.g. CheckBlockIndex(). * and has validity status less than VALID_SCRIPTS. Also that it may have
* It almost certainly means that the block's full validation is pending * descendant blocks with VALID_SCRIPTS set, because they can be validated
* on a background chainstate. See `doc/design/assumeutxo.md`. * based on an assumeutxo snapshot.
*
* When an assumeutxo snapshot is loaded, the ASSUMED_VALID flag is added to
* unvalidated blocks at the snapshot height and below. Then, as the background
* validation progresses, and these blocks are validated, the ASSUMED_VALID
* flags are removed. See `doc/design/assumeutxo.md` for details.
*
* This flag is only used to implement checks in CheckBlockIndex() and
* should not be used elsewhere.
*/ */
BLOCK_ASSUMED_VALID = 256, BLOCK_ASSUMED_VALID = 256,
}; };