aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2014-02-16 22:00:12 +0100
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2014-02-17 15:44:21 +0100
commit82e96006ae03a7debebb9ad36f939ddabb0d2f9f (patch)
treedc250edee27c6e4bae33abcafa999cf74acc0c6e /src/init.cpp
parent879b39075868edd8073d08f75eb91ee0bc07c450 (diff)
add constants for shared (GUI/core) -dbcache settings
- adds nDefaultDbCache, nMaxDbCache and nMinDbCache in txdb.h
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 787c72e154..c05ed4356c 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -196,7 +196,7 @@ std::string HelpMessage(HelpMessageMode hmm)
strUsage += " -testnet " + _("Use the test network") + "\n";
strUsage += " -pid=<file> " + _("Specify pid file (default: bitcoind.pid)") + "\n";
strUsage += " -gen " + _("Generate coins (default: 0)") + "\n";
- strUsage += " -dbcache=<n> " + _("Set database cache size in megabytes (default: 100)") + "\n";
+ strUsage += " -dbcache=<n> " + strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache) + "\n";
strUsage += " -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n";
strUsage += " -proxy=<ip:port> " + _("Connect through SOCKS proxy") + "\n";
strUsage += " -socks=<n> " + _("Select SOCKS version for -proxy (4 or 5, default: 5)") + "\n";
@@ -776,9 +776,11 @@ bool AppInit2(boost::thread_group& threadGroup)
}
// cache size calculations
- size_t nTotalCache = GetArg("-dbcache", 100) << 20;
- if (nTotalCache < (1 << 22))
- nTotalCache = (1 << 22); // total cache cannot be less than 4 MiB
+ size_t nTotalCache = (GetArg("-dbcache", nDefaultDbCache) << 20);
+ if (nTotalCache < (nMinDbCache << 20))
+ nTotalCache = (nMinDbCache << 20); // total cache cannot be less than nMinDbCache
+ else if (nTotalCache > (nMaxDbCache << 20))
+ nTotalCache = (nMaxDbCache << 20); // total cache cannot be greater than nMaxDbCache
size_t nBlockTreeDBCache = nTotalCache / 8;
if (nBlockTreeDBCache > (1 << 21) && !GetBoolArg("-txindex", false))
nBlockTreeDBCache = (1 << 21); // block tree db cache shouldn't be larger than 2 MiB