Page MenuHomePhabricator

init: add utxo snapshot detection, allow on-disk coins and block tree dbs in tests
ClosedPublic

Authored by PiRK on Oct 19 2023, 13:34.

Details

Summary

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

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Oct 19 2023, 13:34
PiRK planned changes to this revision.Oct 19 2023, 13:47
PiRK edited the summary of this revision. (Show Details)

rebase

This revision is now accepted and ready to land.Oct 23 2023, 12:32