aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-12-21 19:15:13 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2016-12-22 15:04:05 -0800
commitba3cecf5c436bf38efad045d46e0aa26210d2234 (patch)
tree316c6db06dc1c8a1b502663fb5d742c72c0692c8 /src/init.cpp
parente8cfe1ee2d01c493b758a67ad14707dca15792ea (diff)
downloadbitcoin-ba3cecf5c436bf38efad045d46e0aa26210d2234.tar.xz
Share unused mempool memory with coincache
If the mempool is not completely full, treat the difference between the maximum size and the actual usage as available for the coin cache. This also changes the early flush trigger from (usage > 0.9 * space) to (usage > 0.9 * space && usage > space - 100MB). This means we're not permanently leaving 10% of the space unused when the space is large.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index e642729a99..0eb206ba8b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1330,10 +1330,11 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
nCoinDBCache = std::min(nCoinDBCache, nMaxCoinsDBCache << 20); // cap total coins db cache
nTotalCache -= nCoinDBCache;
nCoinCacheUsage = nTotalCache; // the rest goes to in-memory cache
+ int64_t nMempoolSizeMax = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
LogPrintf("Cache configuration:\n");
LogPrintf("* Using %.1fMiB for block index database\n", nBlockTreeDBCache * (1.0 / 1024 / 1024));
LogPrintf("* Using %.1fMiB for chain state database\n", nCoinDBCache * (1.0 / 1024 / 1024));
- LogPrintf("* Using %.1fMiB for in-memory UTXO set\n", nCoinCacheUsage * (1.0 / 1024 / 1024));
+ LogPrintf("* Using %.1fMiB for in-memory UTXO set (plus up to %.1fMiB of unused mempool space)\n", nCoinCacheUsage * (1.0 / 1024 / 1024), nMempoolSizeMax * (1.0 / 1024 / 1024));
bool fLoaded = false;
while (!fLoaded) {