aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-07-06 07:46:41 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-07-06 07:46:47 +0200
commit396f9d629662ae8c95bc576000166f5b8941ef0b (patch)
tree2cfbab9d10bcd7cfb3af0aabc126d3f56b366b74 /src/init.cpp
parent042c323922fce00a1cd0d955a0c8b8bfa80e4045 (diff)
parentefd1d8339ad9a2bb7a164e7475734a90f6fa034c (diff)
downloadbitcoin-396f9d629662ae8c95bc576000166f5b8941ef0b.tar.xz
Merge #8273: Bump `-dbcache` default to 300MiB
efd1d83 doc: Mention dbcache increase in release notes (Wladimir J. van der Laan) 32cab91 Bump `-dbcache` default to 300MiB (Wladimir J. van der Laan)
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 0f641821d4..7e91e0ba8b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1216,10 +1216,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
nTotalCache = std::max(nTotalCache, nMinDbCache << 20); // total cache cannot be less than nMinDbCache
nTotalCache = std::min(nTotalCache, nMaxDbCache << 20); // total cache cannot be greated than nMaxDbcache
int64_t nBlockTreeDBCache = nTotalCache / 8;
- if (nBlockTreeDBCache > (1 << 21) && !GetBoolArg("-txindex", DEFAULT_TXINDEX))
- nBlockTreeDBCache = (1 << 21); // block tree db cache shouldn't be larger than 2 MiB
+ nBlockTreeDBCache = std::min(nBlockTreeDBCache, (GetBoolArg("-txindex", DEFAULT_TXINDEX) ? nMaxBlockDBAndTxIndexCache : nMaxBlockDBCache) << 20);
nTotalCache -= nBlockTreeDBCache;
int64_t nCoinDBCache = std::min(nTotalCache / 2, (nTotalCache / 4) + (1 << 23)); // use 25%-50% of the remainder for disk cache
+ nCoinDBCache = std::min(nCoinDBCache, nMaxCoinsDBCache << 20); // cap total coins db cache
nTotalCache -= nCoinDBCache;
nCoinCacheUsage = nTotalCache; // the rest goes to in-memory cache
LogPrintf("Cache configuration:\n");