init: add utxo snapshot detection
Add functionality for activating a snapshot-based chainstate if one is
detected on-disk.Also cautiously initialize chainstate cache usages so that we don't
somehow blow past our cache allowances during initialization, then
rebalance at the end of init.Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
https://github.com/bitcoin/bitcoin/pull/25667/commits/252abd1e8bc5cdf4368ad55e827a873240535b28
blockmanager: avoid undefined behavior during FlushBlockFile
If we call FlushBlockFile() without having intitialized the block index
with LoadBlockIndexDB(), we may be indexing into an empty vector.Specifically this is an issue when we call MaybeRebalanceCaches() during
chainstate init before the block index has been loaded, which calls
FlushBlockFile().Also add an assert to avoid undefined behavior.
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
https://github.com/bitcoin/bitcoin/pull/25667/commits/8153bd9247dad3982d54488bcdb3960470315290
This is a partial backport of core#25667
Depends on D14650