Skip to content

Commit 8bd5f8a

Browse files
[refactor] 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. This is just a simplification and not changing the result of the calculation. Co-authored-by: Ryan Ofsky <[email protected]>
1 parent 5db7d4d commit 8bd5f8a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/node/caches.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
2424
sizes.filter_index = max_cache / n_indexes;
2525
nTotalCache -= sizes.filter_index * n_indexes;
2626
}
27-
sizes.coins_db = std::min(nTotalCache / 2, (nTotalCache / 4) + (1 << 23)); // use 25%-50% of the remainder for disk cache
28-
sizes.coins_db = std::min(sizes.coins_db, nMaxCoinsDBCache << 20); // cap total coins db cache
27+
sizes.coins_db = std::min(nTotalCache / 2, nMaxCoinsDBCache << 20);
2928
nTotalCache -= sizes.coins_db;
3029
sizes.coins = nTotalCache; // the rest goes to in-memory cache
3130
return sizes;

0 commit comments

Comments
 (0)