Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ static const bool DEFAULT_REST_ENABLE = false;
#endif

static const char* DEFAULT_ASMAP_FILENAME="ip_asn.map";
static constexpr int MAX_32BIT_MEMPOOL_MB{500};

/**
* The PID file facilities.
Expand Down Expand Up @@ -976,6 +977,10 @@ bool AppInitParameterInteraction(const ArgsManager& args)
int64_t nMempoolSizeMin = args.GetIntArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40;
if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(nMempoolSizeMin / 1000000.0)));
constexpr bool is_32bit{sizeof(void*) == 4};
if (is_32bit && nMempoolSizeMax > MAX_32BIT_MEMPOOL_MB * 1000000) {
return InitError(strprintf(_("-maxmempool is set to %i but can't be over %i MB on 32-bit systems"), std::ceil(nMempoolSizeMax / 1000000.0), MAX_32BIT_MEMPOOL_MB));
}
// incremental relay fee sets the minimum feerate increase necessary for BIP 125 replacement in the mempool
// and the amount the mempool min fee increases above the feerate of txs evicted due to mempool limiting.
if (args.IsArgSet("-incrementalrelayfee")) {
Expand Down
4 changes: 4 additions & 0 deletions src/node/caches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
#include <util/system.h>
#include <validation.h>

//! Maximum dbcache size on 32-bit systems.
static constexpr int64_t MAX_32BIT_DBCACHE = 1ULL << 30; // 1 GiB

namespace node {
CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
{
int64_t nTotalCache = (args.GetIntArg("-dbcache", nDefaultDbCache) << 20);
nTotalCache = std::max(nTotalCache, nMinDbCache << 20); // total cache cannot be less than nMinDbCache
nTotalCache = std::min(nTotalCache, nMaxDbCache << 20); // total cache cannot be greater than nMaxDbcache
if (sizeof(void*) == 4) nTotalCache = std::min(nTotalCache, MAX_32BIT_DBCACHE);
CacheSizes sizes;
sizes.block_tree_db = std::min(nTotalCache / 8, nMaxBlockDBCache << 20);
nTotalCache -= sizes.block_tree_db;
Expand Down