This PR contains the first part of #28608, which tries to make assumeutxo code more maintainable, and improve it by not locking cs_main
for a long time when the snapshot block is connected, and by deleting the snapshot validation chainstate when it is no longer used, instead of waiting until the next restart.
The changes in this PR are just refactoring. They make Chainstate
objects self-contained, so for example, it is possible to determine what blocks to connect to a chainstate without querying ChainstateManager
, and to determine whether a Chainstate is validated without basing it on inferences like &cs != &ActiveChainstate()
or GetAll().size() == 1
.
The PR also tries to make assumeutxo terminology less confusing, using “current chainstate” to refer to the chainstate targeting the current network tip, and “historical chainstate” to refer to the chainstate downloading old blocks and validating the assumeutxo snapshot. It removes uses of the terms “active chainstate,” “usable chainstate,” “disabled chainstate,” “ibd chainstate,” and “snapshot chainstate” which are confusing for various reasons.