mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
init: Simplify coinsdb cache calculation
(total_cache / 4) + (1 << 23) is at least 8 MiB and nMaxCoinsDBCache is also 8 MiB, so the minimum between the two will always be nMaxCoinsDBCache. Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
parent
5db7d4d3d2
commit
19316eccaf
1 changed files with 1 additions and 2 deletions
|
@ -24,8 +24,7 @@ CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
|
|||
sizes.filter_index = max_cache / n_indexes;
|
||||
nTotalCache -= sizes.filter_index * n_indexes;
|
||||
}
|
||||
sizes.coins_db = std::min(nTotalCache / 2, (nTotalCache / 4) + (1 << 23)); // use 25%-50% of the remainder for disk cache
|
||||
sizes.coins_db = std::min(sizes.coins_db, nMaxCoinsDBCache << 20); // cap total coins db cache
|
||||
sizes.coins_db = std::min(nTotalCache / 2, nMaxCoinsDBCache << 20);
|
||||
nTotalCache -= sizes.coins_db;
|
||||
sizes.coins = nTotalCache; // the rest goes to in-memory cache
|
||||
return sizes;
|
||||
|
|
Loading…
Reference in a new issue