This is part of the assumeutxo project:
Parent PR: #15606 Issue: #15605 Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal
This change proposes logic for activating UTXO snapshots, which is unused at the moment aside from an included unittest. There are a few moveonyish/refactoring commits to allow for halfway decent unittests.
Basic structure is included for specifying and checking the assumeutxo hash values used to validate activated snapshots. Initially I had specified a few height/hash pairs for mainnet in this change, but because of the security-critical nature of those parameters, I figured it was better to leave their inclusion to a future PR that includes only that change - my intent being that reviewers will be more likely to verify those parameters firsthand in a dedicated PR.
Aside from that and the snapshot activation logic, there are a few related changes:
allow caching thenChainTx
value in the CCoinsViewDB; this is set during snapshot activation. Because we don’t necessarily have access to the full chain at the time of snapshot load, this value is communicated through the snapshot metadata and must be cached within the chainstate to survive restarts.- break out
CreateUTXOSnapshot()
from dumptxoutset. This is essentially a move-only change to allow the reuse of snapshot creation logic from within unittests. - …and a few other misc. changes that are solely related to unittests.
The move-onlyish commit is most easily reviewed with --color-moved=zebra
.