diff --git a/src/init.cpp b/src/init.cpp index 44f060794e0..c25e07bf65f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -530,7 +530,7 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc) argsman.AddArg("-conf=", strprintf("Specify path to read-only configuration file. Relative paths will be prefixed by datadir location (only useable from command line, not configuration file) (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-datadir=", "Specify data directory", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::OPTIONS); argsman.AddArg("-dbbatchsize", strprintf("Maximum database write batch size in bytes (default: %u)", DEFAULT_DB_CACHE_BATCH), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS); - argsman.AddArg("-dbcache=", strprintf("Maximum database cache size MiB (minimum %d, default: %d). Make sure you have enough RAM. In addition, unused memory allocated to the mempool is shared with this cache (see -maxmempool).", MIN_DB_CACHE / 1_MiB, node::GetDefaultDBCache() / 1_MiB), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); + argsman.AddArg("-dbcache=", strprintf("Maximum database cache size MiB (minimum %d, default: %d). Make sure you have enough RAM. In addition, unused memory allocated to the mempool is shared with this cache (see -maxmempool).", MIN_DBCACHE_BYTES / 1_MiB, node::GetDefaultDBCache() / 1_MiB), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-includeconf=", "Specify additional configuration file, relative to the -datadir path (only useable from configuration file, not command line)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-allowignoredconf", strprintf("For backwards compatibility, treat an unused %s file in the datadir as a warning, not an error.", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-loadblock=", "Imports blocks from an external file on startup. Obfuscated blocks are not supported.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); diff --git a/src/node/caches.cpp b/src/node/caches.cpp index ea69c717760..37b674fa918 100644 --- a/src/node/caches.cpp +++ b/src/node/caches.cpp @@ -53,7 +53,7 @@ uint64_t CalculateDbCacheBytes(const ArgsManager& args) if (*db_cache < 0) db_cache = 0; const uint64_t db_cache_bytes{SaturatingLeftShift(*db_cache, 20)}; constexpr uint64_t max_db_cache{sizeof(void*) == 4 ? MAX_32BIT_DBCACHE : std::numeric_limits::max()}; - return std::max(MIN_DB_CACHE, std::min(db_cache_bytes, max_db_cache)); + return std::max(MIN_DBCACHE_BYTES, std::min(db_cache_bytes, max_db_cache)); } return GetDefaultDBCache(); } diff --git a/src/node/caches.h b/src/node/caches.h index 4fd14ed9d0c..8bfd499b9ea 100644 --- a/src/node/caches.h +++ b/src/node/caches.h @@ -15,7 +15,7 @@ class ArgsManager; //! min. -dbcache (bytes) -static constexpr uint64_t MIN_DB_CACHE{4_MiB}; +static constexpr uint64_t MIN_DBCACHE_BYTES{4_MiB}; //! -dbcache default (bytes) static constexpr uint64_t DEFAULT_DB_CACHE{DEFAULT_KERNEL_CACHE}; //! Reserved non-dbcache memory usage. diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index a68829c2ca1..e7b769c4ebf 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -95,7 +95,7 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet) ui->verticalLayout->setStretchFactor(ui->tabWidget, 1); /* Main elements init */ - ui->databaseCache->setRange(MIN_DB_CACHE / 1_MiB, std::numeric_limits::max()); + ui->databaseCache->setRange(MIN_DBCACHE_BYTES / 1_MiB, std::numeric_limits::max()); ui->threadsScriptVerif->setMinimum(-GetNumCores()); ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS); ui->pruneWarning->setVisible(false); diff --git a/src/test/caches_tests.cpp b/src/test/caches_tests.cpp index c96bef7e254..8144aac00d5 100644 --- a/src/test/caches_tests.cpp +++ b/src/test/caches_tests.cpp @@ -23,7 +23,7 @@ BOOST_AUTO_TEST_SUITE(caches_tests) BOOST_AUTO_TEST_CASE(oversized_dbcache_warning) { - BOOST_CHECK(!ShouldWarnOversizedDbCache(MIN_DB_CACHE, 1_GiB)); + BOOST_CHECK(!ShouldWarnOversizedDbCache(MIN_DBCACHE_BYTES, 1_GiB)); // Below DBCACHE_WARNING_RESERVED_RAM the existing fixed default dominates. CheckDbCacheWarnThreshold(DEFAULT_DB_CACHE, 1_GiB);