Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | if (!lockShutdown) { | ||||
return; | return; | ||||
} | } | ||||
/// Note: Shutdown() must be able to handle cases in which AppInit2() failed | /// Note: Shutdown() must be able to handle cases in which AppInit2() failed | ||||
/// part of the way, for example if the data directory was found to be | /// part of the way, for example if the data directory was found to be | ||||
/// locked. Be sure that anything that writes files or flushes caches only | /// locked. Be sure that anything that writes files or flushes caches only | ||||
/// does this if the respective module was initialized. | /// does this if the respective module was initialized. | ||||
RenameThread("bitcoin-shutoff"); | RenameThread("bitcoin-shutoff"); | ||||
mempool.AddTransactionsUpdated(1); | g_mempool.AddTransactionsUpdated(1); | ||||
StopHTTPRPC(); | StopHTTPRPC(); | ||||
StopREST(); | StopREST(); | ||||
StopRPC(); | StopRPC(); | ||||
StopHTTPServer(); | StopHTTPServer(); | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
for (CWalletRef pwallet : vpwallets) { | for (CWalletRef pwallet : vpwallets) { | ||||
pwallet->Flush(false); | pwallet->Flush(false); | ||||
Show All 14 Lines | if (fDumpMempoolLater && | ||||
DumpMempool(); | DumpMempool(); | ||||
} | } | ||||
if (fFeeEstimatesInitialized) { | if (fFeeEstimatesInitialized) { | ||||
fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; | fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; | ||||
CAutoFile est_fileout(fsbridge::fopen(est_path, "wb"), SER_DISK, | CAutoFile est_fileout(fsbridge::fopen(est_path, "wb"), SER_DISK, | ||||
CLIENT_VERSION); | CLIENT_VERSION); | ||||
if (!est_fileout.IsNull()) { | if (!est_fileout.IsNull()) { | ||||
mempool.WriteFeeEstimates(est_fileout); | g_mempool.WriteFeeEstimates(est_fileout); | ||||
} else { | } else { | ||||
LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, | LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, | ||||
est_path.string()); | est_path.string()); | ||||
} | } | ||||
fFeeEstimatesInitialized = false; | fFeeEstimatesInitialized = false; | ||||
} | } | ||||
// FlushStateToDisk generates a SetBestChain callback, which we should avoid | // FlushStateToDisk generates a SetBestChain callback, which we should avoid | ||||
▲ Show 20 Lines • Show All 1,242 Lines • ▼ Show 20 Lines | bool AppInitParameterInteraction(Config &config, RPCServer &rpcServer) { | ||||
// Checkmempool and checkblockindex default to true in regtest mode | // Checkmempool and checkblockindex default to true in regtest mode | ||||
int ratio = std::min<int>( | int ratio = std::min<int>( | ||||
std::max<int>( | std::max<int>( | ||||
gArgs.GetArg("-checkmempool", | gArgs.GetArg("-checkmempool", | ||||
chainparams.DefaultConsistencyChecks() ? 1 : 0), | chainparams.DefaultConsistencyChecks() ? 1 : 0), | ||||
0), | 0), | ||||
1000000); | 1000000); | ||||
if (ratio != 0) { | if (ratio != 0) { | ||||
mempool.setSanityCheck(1.0 / ratio); | g_mempool.setSanityCheck(1.0 / ratio); | ||||
} | } | ||||
fCheckBlockIndex = gArgs.GetBoolArg("-checkblockindex", | fCheckBlockIndex = gArgs.GetBoolArg("-checkblockindex", | ||||
chainparams.DefaultConsistencyChecks()); | chainparams.DefaultConsistencyChecks()); | ||||
fCheckpointsEnabled = | fCheckpointsEnabled = | ||||
gArgs.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED); | gArgs.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED); | ||||
hashAssumeValid = uint256S( | hashAssumeValid = uint256S( | ||||
gArgs.GetArg("-assumevalid", | gArgs.GetArg("-assumevalid", | ||||
▲ Show 20 Lines • Show All 703 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart); | LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart); | ||||
fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; | fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; | ||||
CAutoFile est_filein(fsbridge::fopen(est_path, "rb"), SER_DISK, | CAutoFile est_filein(fsbridge::fopen(est_path, "rb"), SER_DISK, | ||||
CLIENT_VERSION); | CLIENT_VERSION); | ||||
// Allowed to fail as this file IS missing on first startup. | // Allowed to fail as this file IS missing on first startup. | ||||
if (!est_filein.IsNull()) { | if (!est_filein.IsNull()) { | ||||
mempool.ReadFeeEstimates(est_filein); | g_mempool.ReadFeeEstimates(est_filein); | ||||
} | } | ||||
fFeeEstimatesInitialized = true; | fFeeEstimatesInitialized = true; | ||||
// Encoded addresses using cashaddr instead of base58 | // Encoded addresses using cashaddr instead of base58 | ||||
// Activates by default on Jan, 14 | // Activates by default on Jan, 14 | ||||
config.SetCashAddrEncoding( | config.SetCashAddrEncoding( | ||||
gArgs.GetBoolArg("-usecashaddr", GetAdjustedTime() > 1515900000)); | gArgs.GetBoolArg("-usecashaddr", GetAdjustedTime() > 1515900000)); | ||||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |