Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
#ifndef WIN32 | #ifndef WIN32 | ||||
#include <attributes.h> | #include <attributes.h> | ||||
#include <cerrno> | #include <cerrno> | ||||
#include <csignal> | #include <csignal> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#endif | #endif | ||||
#include <algorithm> | |||||
#include <cstdint> | #include <cstdint> | ||||
#include <cstdio> | #include <cstdio> | ||||
#include <functional> | #include <functional> | ||||
#include <set> | #include <set> | ||||
#include <thread> | #include <thread> | ||||
#include <vector> | #include <vector> | ||||
using node::CacheSizes; | using node::CacheSizes; | ||||
▲ Show 20 Lines • Show All 2,325 Lines • ▼ Show 20 Lines | LogPrintf("* Using %.1f MiB for chain state database\n", | ||||
cache_sizes.coins_db * (1.0 / 1024 / 1024)); | cache_sizes.coins_db * (1.0 / 1024 / 1024)); | ||||
LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of " | LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of " | ||||
"unused mempool space)\n", | "unused mempool space)\n", | ||||
cache_sizes.coins * (1.0 / 1024 / 1024), | cache_sizes.coins * (1.0 / 1024 / 1024), | ||||
nMempoolSizeMax * (1.0 / 1024 / 1024)); | nMempoolSizeMax * (1.0 / 1024 / 1024)); | ||||
assert(!node.mempool); | assert(!node.mempool); | ||||
assert(!node.chainman); | assert(!node.chainman); | ||||
int check_ratio = std::min<int>( | const int mempool_check_ratio = std::clamp<int>( | ||||
std::max<int>( | |||||
args.GetIntArg("-checkmempool", | args.GetIntArg("-checkmempool", | ||||
chainparams.DefaultConsistencyChecks() ? 1 : 0), | chainparams.DefaultConsistencyChecks() ? 1 : 0), | ||||
0), | 0, 1000000); | ||||
1000000); | |||||
for (bool fLoaded = false; !fLoaded && !ShutdownRequested();) { | for (bool fLoaded = false; !fLoaded && !ShutdownRequested();) { | ||||
node.mempool = std::make_unique<CTxMemPool>(check_ratio); | node.mempool = std::make_unique<CTxMemPool>(mempool_check_ratio); | ||||
node.chainman = std::make_unique<ChainstateManager>(); | node.chainman = std::make_unique<ChainstateManager>(); | ||||
ChainstateManager &chainman = *node.chainman; | ChainstateManager &chainman = *node.chainman; | ||||
const bool fReset = fReindex; | const bool fReset = fReindex; | ||||
bilingual_str strLoadError; | bilingual_str strLoadError; | ||||
uiInterface.InitMessage(_("Loading block index...").translated); | uiInterface.InitMessage(_("Loading block index...").translated); | ||||
▲ Show 20 Lines • Show All 519 Lines • Show Last 20 Lines |