This is part of the assumeutxo project (parent PR: #15606)
Modify UpdateTip and CheckBlockIndex for use with multiple chainstates. Includes a new unittest verifying g_best_block
behavior (previously untested at the unit level) and various changes necessary for running and testing ProcessNewBlock()
-like behavior on the background validation chainstate.
This changeset introduces a new block index nStatus
flag called BLOCK_ASSUMED_VALID
, and it is applied to block index entries that are beneath the UTXO snapshot base block upon snapshot load. Once each block is validated (during async background validation), the flag is removed. This allows us to avoid (ab)using BLOCK_VALID_*
flags for snapshot chain block entries, and preserves the original meaning of those flags.
Note: this PR previously incorporated changes to LoadBlockIndex()
and RewindBlockIndex()
as noted in Russ’ comments below, but once I generated the changes necessary to test the UpdateTip change, I decided to split this changes out into another PR due to the size of this one.