Changeset View
Changeset View
Standalone View
Standalone View
src/node/caches.cpp
// Copyright (c) 2021 The Bitcoin Core developers | // Copyright (c) 2021 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <node/caches.h> | #include <node/caches.h> | ||||
#include <index/txindex.h> | |||||
#include <txdb.h> | #include <txdb.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <validation.h> | |||||
namespace node { | namespace node { | ||||
CacheSizes CalculateCacheSizes(const ArgsManager &args, size_t n_indexes) { | CacheSizes CalculateCacheSizes(const ArgsManager &args, size_t n_indexes) { | ||||
int64_t nTotalCache = | int64_t nTotalCache = | ||||
(args.GetIntArg("-dbcache", DEFAULT_DB_CACHE_MB) << 20); | (args.GetIntArg("-dbcache", DEFAULT_DB_CACHE_MB) << 20); | ||||
// total cache cannot be less than MIN_DB_CACHE_MB | // total cache cannot be less than MIN_DB_CACHE_MB | ||||
nTotalCache = std::max(nTotalCache, MIN_DB_CACHE_MB << 20); | nTotalCache = std::max(nTotalCache, MIN_DB_CACHE_MB << 20); | ||||
// total cache cannot be greater than MAX_DB_CACHE_MB | // total cache cannot be greater than MAX_DB_CACHE_MB | ||||
Show All 31 Lines |