mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
refactor: Delete ChainstateManager::GetAll() method
Just use m_chainstates array instead.
This commit is contained in:
@@ -318,9 +318,16 @@ void BlockManager::FindFilesToPrune(
|
||||
ChainstateManager& chainman)
|
||||
{
|
||||
LOCK2(cs_main, cs_LastBlockFile);
|
||||
// Distribute our -prune budget over all chainstates.
|
||||
// Compute `target` value with maximum size (in bytes) of blocks below the
|
||||
// `last_prune` height which should be preserved and not pruned. The
|
||||
// `target` value will be derived from the -prune preference provided by the
|
||||
// user. If there is a historical chainstate being used to populate indexes
|
||||
// and validate the snapshot, the target is divided by two so half of the
|
||||
// block storage will be reserved for the historical chainstate, and the
|
||||
// other half will be reserved for the most-work chainstate.
|
||||
const int num_chainstates{chainman.HistoricalChainstate() ? 2 : 1};
|
||||
const auto target = std::max(
|
||||
MIN_DISK_SPACE_FOR_BLOCK_FILES, GetPruneTarget() / chainman.GetAll().size());
|
||||
MIN_DISK_SPACE_FOR_BLOCK_FILES, GetPruneTarget() / num_chainstates);
|
||||
const uint64_t target_sync_height = chainman.m_best_header->nHeight;
|
||||
|
||||
if (chain.m_chain.Height() < 0 || target == 0) {
|
||||
|
||||
Reference in New Issue
Block a user