Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 311 Lines • ▼ Show 20 Lines | #if ENABLE_ZMQ | ||||
} | } | ||||
#endif | #endif | ||||
node.chain_clients.clear(); | node.chain_clients.clear(); | ||||
UnregisterAllValidationInterfaces(); | UnregisterAllValidationInterfaces(); | ||||
GetMainSignals().UnregisterBackgroundSignalScheduler(); | GetMainSignals().UnregisterBackgroundSignalScheduler(); | ||||
globalVerifyHandle.reset(); | globalVerifyHandle.reset(); | ||||
ECC_Stop(); | ECC_Stop(); | ||||
node.mempool = nullptr; | node.mempool.reset(); | ||||
node.chainman = nullptr; | node.chainman = nullptr; | ||||
node.scheduler.reset(); | node.scheduler.reset(); | ||||
try { | try { | ||||
if (!fs::remove(GetPidFile(*node.args))) { | if (!fs::remove(GetPidFile(*node.args))) { | ||||
LogPrintf("%s: Unable to remove PID file: File does not exist\n", | LogPrintf("%s: Unable to remove PID file: File does not exist\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,950 Lines • ▼ Show 20 Lines | node.connman = std::make_unique<CConnman>( | ||||
config, GetRand(std::numeric_limits<uint64_t>::max()), | config, GetRand(std::numeric_limits<uint64_t>::max()), | ||||
GetRand(std::numeric_limits<uint64_t>::max()), | GetRand(std::numeric_limits<uint64_t>::max()), | ||||
gArgs.GetBoolArg("-networkactive", true)); | gArgs.GetBoolArg("-networkactive", true)); | ||||
// Make mempool generally available in the node context. For example the | // Make mempool generally available in the node context. For example the | ||||
// connection manager, wallet, or RPC threads, which are all started after | // connection manager, wallet, or RPC threads, which are all started after | ||||
// this, may use it from the node context. | // this, may use it from the node context. | ||||
assert(!node.mempool); | assert(!node.mempool); | ||||
node.mempool = &::g_mempool; | node.mempool = std::make_unique<CTxMemPool>(); | ||||
if (node.mempool) { | if (node.mempool) { | ||||
int ratio = std::min<int>( | int ratio = std::min<int>( | ||||
std::max<int>( | std::max<int>( | ||||
args.GetArg("-checkmempool", | args.GetArg("-checkmempool", | ||||
chainparams.DefaultConsistencyChecks() ? 1 : 0), | chainparams.DefaultConsistencyChecks() ? 1 : 0), | ||||
0), | 0), | ||||
1000000); | 1000000); | ||||
if (ratio != 0) { | if (ratio != 0) { | ||||
▲ Show 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | while (!fLoaded && !ShutdownRequested()) { | ||||
bool failed_verification = false; | bool failed_verification = false; | ||||
const int64_t load_block_index_start_time = GetTimeMillis(); | const int64_t load_block_index_start_time = GetTimeMillis(); | ||||
try { | try { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
chainman.InitializeChainstate(*Assert(node.mempool)); | chainman.InitializeChainstate(*Assert(node.mempool)); | ||||
chainman.m_total_coinstip_cache = nCoinCacheUsage; | chainman.m_total_coinstip_cache = nCoinCacheUsage; | ||||
chainman.m_total_coinsdb_cache = nCoinDBCache; | chainman.m_total_coinsdb_cache = nCoinDBCache; | ||||
UnloadBlockIndex(node.mempool); | UnloadBlockIndex(node.mempool.get()); | ||||
// new CBlockTreeDB tries to delete the existing file, which | // new CBlockTreeDB tries to delete the existing file, which | ||||
// fails if it's still open from the previous loop. Close it | // fails if it's still open from the previous loop. Close it | ||||
// first: | // first: | ||||
pblocktree.reset(); | pblocktree.reset(); | ||||
pblocktree.reset( | pblocktree.reset( | ||||
new CBlockTreeDB(nBlockTreeDBCache, false, fReset)); | new CBlockTreeDB(nBlockTreeDBCache, false, fReset)); | ||||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |