From 19316eccaf93776c49b1870f8aa9a5fe57ec5f33 Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Tue, 17 Dec 2024 21:33:56 +0100 Subject: [PATCH] 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 --- src/node/caches.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/node/caches.cpp b/src/node/caches.cpp index dc4d98f592a..01b08e320d7 100644 --- a/src/node/caches.cpp +++ b/src/node/caches.cpp @@ -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;