Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | public: | ||||
CCoinsViewErrorCatcher(CCoinsView *view) : CCoinsViewBacked(view) {} | CCoinsViewErrorCatcher(CCoinsView *view) : CCoinsViewBacked(view) {} | ||||
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override { | bool GetCoin(const COutPoint &outpoint, Coin &coin) const override { | ||||
try { | try { | ||||
return CCoinsViewBacked::GetCoin(outpoint, coin); | return CCoinsViewBacked::GetCoin(outpoint, coin); | ||||
} catch (const std::runtime_error &e) { | } catch (const std::runtime_error &e) { | ||||
uiInterface.ThreadSafeMessageBox( | uiInterface.ThreadSafeMessageBox( | ||||
_("Error reading from database, shutting down."), "", | _("Error reading from database, shutting down."), "", | ||||
CClientUIInterface::MSG_ERROR); | CClientUIInterface::MSG_ERROR); | ||||
LogPrintf("Error reading from database: %s\n", e.what()); | LogPrint(BCLog::LEVELDB, "Error reading from database: %s\n", | ||||
e.what()); | |||||
// Starting the shutdown sequence and returning false to the caller | // Starting the shutdown sequence and returning false to the caller | ||||
// would be interpreted as 'entry not found' (as opposed to unable | // would be interpreted as 'entry not found' (as opposed to unable | ||||
// to read data), and could lead to invalid interpretation. Just | // to read data), and could lead to invalid interpretation. Just | ||||
// exit immediately, as we can't continue anyway, and all writes | // exit immediately, as we can't continue anyway, and all writes | ||||
// should be atomic. | // should be atomic. | ||||
abort(); | abort(); | ||||
} | } | ||||
} | } | ||||
Show All 13 Lines | void Interrupt(boost::thread_group &threadGroup) { | ||||
InterruptMapPort(); | InterruptMapPort(); | ||||
if (g_connman) { | if (g_connman) { | ||||
g_connman->Interrupt(); | g_connman->Interrupt(); | ||||
} | } | ||||
threadGroup.interrupt_all(); | threadGroup.interrupt_all(); | ||||
} | } | ||||
void Shutdown() { | void Shutdown() { | ||||
LogPrintf("%s: In progress...\n", __func__); | LogPrint(BCLog::INIT, "%s: In progress...\n", __func__); | ||||
static CCriticalSection cs_Shutdown; | static CCriticalSection cs_Shutdown; | ||||
TRY_LOCK(cs_Shutdown, lockShutdown); | TRY_LOCK(cs_Shutdown, lockShutdown); | ||||
if (!lockShutdown) { | 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 | ||||
Show All 28 Lines | #endif | ||||
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); | mempool.WriteFeeEstimates(est_fileout); | ||||
} else { | } else { | ||||
LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, | LogPrint(BCLog::ESTIMATEFEE, | ||||
"%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 | ||||
// missing | // missing | ||||
if (pcoinsTip != nullptr) { | if (pcoinsTip != nullptr) { | ||||
FlushStateToDisk(); | FlushStateToDisk(); | ||||
Show All 32 Lines | if (pzmqNotificationInterface) { | ||||
pzmqNotificationInterface = nullptr; | pzmqNotificationInterface = nullptr; | ||||
} | } | ||||
#endif | #endif | ||||
#ifndef WIN32 | #ifndef WIN32 | ||||
try { | try { | ||||
fs::remove(GetPidFile()); | fs::remove(GetPidFile()); | ||||
} catch (const fs::filesystem_error &e) { | } catch (const fs::filesystem_error &e) { | ||||
LogPrintf("%s: Unable to remove pidfile: %s\n", __func__, e.what()); | LogPrint(BCLog::INIT, "%s: Unable to remove pidfile: %s\n", __func__, | ||||
e.what()); | |||||
} | } | ||||
#endif | #endif | ||||
UnregisterAllValidationInterfaces(); | UnregisterAllValidationInterfaces(); | ||||
GetMainSignals().UnregisterBackgroundSignalScheduler(); | GetMainSignals().UnregisterBackgroundSignalScheduler(); | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
for (CWalletRef pwallet : vpwallets) { | for (CWalletRef pwallet : vpwallets) { | ||||
delete pwallet; | delete pwallet; | ||||
} | } | ||||
vpwallets.clear(); | vpwallets.clear(); | ||||
#endif | #endif | ||||
globalVerifyHandle.reset(); | globalVerifyHandle.reset(); | ||||
ECC_Stop(); | ECC_Stop(); | ||||
LogPrintf("%s: done\n", __func__); | LogPrint(BCLog::INIT, "%s: done\n", __func__); | ||||
} | } | ||||
/** | /** | ||||
* Signal handlers are very limited in what they are allowed to do, so: | * Signal handlers are very limited in what they are allowed to do, so: | ||||
*/ | */ | ||||
void HandleSIGTERM(int) { | void HandleSIGTERM(int) { | ||||
fRequestShutdown = true; | fRequestShutdown = true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 687 Lines • ▼ Show 20 Lines | |||||
// with what's actually on disk by the time we start downloading, so that | // with what's actually on disk by the time we start downloading, so that | ||||
// pruning works correctly. | // pruning works correctly. | ||||
void CleanupBlockRevFiles() { | void CleanupBlockRevFiles() { | ||||
std::map<std::string, fs::path> mapBlockFiles; | std::map<std::string, fs::path> mapBlockFiles; | ||||
// Glob all blk?????.dat and rev?????.dat files from the blocks directory. | // Glob all blk?????.dat and rev?????.dat files from the blocks directory. | ||||
// Remove the rev files immediately and insert the blk file paths into an | // Remove the rev files immediately and insert the blk file paths into an | ||||
// ordered map keyed by block file index. | // ordered map keyed by block file index. | ||||
LogPrintf("Removing unusable blk?????.dat and rev?????.dat files for " | LogPrint(BCLog::INIT, | ||||
"Removing unusable blk?????.dat and rev?????.dat files for " | |||||
"-reindex with -prune\n"); | "-reindex with -prune\n"); | ||||
fs::path blocksdir = GetDataDir() / "blocks"; | fs::path blocksdir = GetDataDir() / "blocks"; | ||||
for (fs::directory_iterator it(blocksdir); it != fs::directory_iterator(); | for (fs::directory_iterator it(blocksdir); it != fs::directory_iterator(); | ||||
it++) { | it++) { | ||||
if (is_regular_file(*it) && | if (is_regular_file(*it) && | ||||
it->path().filename().string().length() == 12 && | it->path().filename().string().length() == 12 && | ||||
it->path().filename().string().substr(8, 4) == ".dat") { | it->path().filename().string().substr(8, 4) == ".dat") { | ||||
if (it->path().filename().string().substr(0, 3) == "blk") { | if (it->path().filename().string().substr(0, 3) == "blk") { | ||||
mapBlockFiles[it->path().filename().string().substr(3, 5)] = | mapBlockFiles[it->path().filename().string().substr(3, 5)] = | ||||
Show All 33 Lines | RenameThread("bitcoin-loadblk"); | ||||
// No block files left to reindex | // No block files left to reindex | ||||
break; | break; | ||||
} | } | ||||
FILE *file = OpenBlockFile(pos, true); | FILE *file = OpenBlockFile(pos, true); | ||||
if (!file) { | if (!file) { | ||||
// This error is logged in OpenBlockFile | // This error is logged in OpenBlockFile | ||||
break; | break; | ||||
} | } | ||||
LogPrintf("Reindexing block file blk%05u.dat...\n", | LogPrint(BCLog::REINDEX, | ||||
"Reindexing block file blk%05u.dat...\n", | |||||
(unsigned int)nFile); | (unsigned int)nFile); | ||||
LoadExternalBlockFile(config, file, &pos); | LoadExternalBlockFile(config, file, &pos); | ||||
nFile++; | nFile++; | ||||
} | } | ||||
pblocktree->WriteReindexing(false); | pblocktree->WriteReindexing(false); | ||||
fReindex = false; | fReindex = false; | ||||
LogPrintf("Reindexing finished\n"); | LogPrint(BCLog::REINDEX, "Reindexing finished\n"); | ||||
// To avoid ending up in a situation without genesis block, re-try | // To avoid ending up in a situation without genesis block, re-try | ||||
// initializing (no-op if reindexing worked): | // initializing (no-op if reindexing worked): | ||||
LoadGenesisBlock(config.GetChainParams()); | LoadGenesisBlock(config.GetChainParams()); | ||||
} | } | ||||
// hardcoded $DATADIR/bootstrap.dat | // hardcoded $DATADIR/bootstrap.dat | ||||
fs::path pathBootstrap = GetDataDir() / "bootstrap.dat"; | fs::path pathBootstrap = GetDataDir() / "bootstrap.dat"; | ||||
if (fs::exists(pathBootstrap)) { | if (fs::exists(pathBootstrap)) { | ||||
FILE *file = fsbridge::fopen(pathBootstrap, "rb"); | FILE *file = fsbridge::fopen(pathBootstrap, "rb"); | ||||
if (file) { | if (file) { | ||||
fs::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old"; | fs::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old"; | ||||
LogPrintf("Importing bootstrap.dat...\n"); | LogPrint(BCLog::INIT, "Importing bootstrap.dat...\n"); | ||||
LoadExternalBlockFile(config, file); | LoadExternalBlockFile(config, file); | ||||
RenameOver(pathBootstrap, pathBootstrapOld); | RenameOver(pathBootstrap, pathBootstrapOld); | ||||
} else { | } else { | ||||
LogPrintf("Warning: Could not open bootstrap file %s\n", | LogPrint(BCLog::INIT, | ||||
"Warning: Could not open bootstrap file %s\n", | |||||
pathBootstrap.string()); | pathBootstrap.string()); | ||||
} | } | ||||
} | } | ||||
// -loadblock= | // -loadblock= | ||||
for (const fs::path &path : vImportFiles) { | for (const fs::path &path : vImportFiles) { | ||||
FILE *file = fsbridge::fopen(path, "rb"); | FILE *file = fsbridge::fopen(path, "rb"); | ||||
if (file) { | if (file) { | ||||
LogPrintf("Importing blocks file %s...\n", path.string()); | LogPrint(BCLog::INIT, "Importing blocks file %s...\n", | ||||
path.string()); | |||||
LoadExternalBlockFile(config, file); | LoadExternalBlockFile(config, file); | ||||
} else { | } else { | ||||
LogPrintf("Warning: Could not open blocks file %s\n", | LogPrint(BCLog::INIT, | ||||
"Warning: Could not open blocks file %s\n", | |||||
path.string()); | path.string()); | ||||
} | } | ||||
} | } | ||||
// scan for better chains in the block chain database, that are not yet | // scan for better chains in the block chain database, that are not yet | ||||
// connected in the active best chain | // connected in the active best chain | ||||
CValidationState state; | CValidationState state; | ||||
if (!ActivateBestChain(config, state)) { | if (!ActivateBestChain(config, state)) { | ||||
LogPrintf("Failed to connect best block"); | LogPrint(BCLog::INIT, "Failed to connect best block"); | ||||
StartShutdown(); | StartShutdown(); | ||||
} | } | ||||
if (gArgs.GetBoolArg("-stopafterblockimport", | if (gArgs.GetBoolArg("-stopafterblockimport", | ||||
DEFAULT_STOPAFTERBLOCKIMPORT)) { | DEFAULT_STOPAFTERBLOCKIMPORT)) { | ||||
LogPrintf("Stopping after block import\n"); | LogPrint(BCLog::INIT, "Stopping after block import\n"); | ||||
StartShutdown(); | StartShutdown(); | ||||
} | } | ||||
} // End scope of CImportingNow | } // End scope of CImportingNow | ||||
if (gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) { | if (gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) { | ||||
LoadMempool(config); | LoadMempool(config); | ||||
fDumpMempoolLater = !fRequestShutdown; | fDumpMempoolLater = !fRequestShutdown; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
// Parameter interaction based on rules | // Parameter interaction based on rules | ||||
void InitParameterInteraction() { | void InitParameterInteraction() { | ||||
// when specifying an explicit binding address, you want to listen on it | // when specifying an explicit binding address, you want to listen on it | ||||
// even when -connect or -proxy is specified. | // even when -connect or -proxy is specified. | ||||
if (gArgs.IsArgSet("-bind")) { | if (gArgs.IsArgSet("-bind")) { | ||||
if (gArgs.SoftSetBoolArg("-listen", true)) { | if (gArgs.SoftSetBoolArg("-listen", true)) { | ||||
LogPrintf( | LogPrint( | ||||
BCLog::NET, | |||||
"%s: parameter interaction: -bind set -> setting -listen=1\n", | "%s: parameter interaction: -bind set -> setting -listen=1\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
} | } | ||||
if (gArgs.IsArgSet("-whitebind")) { | if (gArgs.IsArgSet("-whitebind")) { | ||||
if (gArgs.SoftSetBoolArg("-listen", true)) { | if (gArgs.SoftSetBoolArg("-listen", true)) { | ||||
LogPrintf("%s: parameter interaction: -whitebind set -> setting " | LogPrint(BCLog::NET, | ||||
"%s: parameter interaction: -whitebind set -> setting " | |||||
"-listen=1\n", | "-listen=1\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
} | } | ||||
if (gArgs.IsArgSet("-connect")) { | if (gArgs.IsArgSet("-connect")) { | ||||
// when only connecting to trusted nodes, do not seed via DNS, or listen | // when only connecting to trusted nodes, do not seed via DNS, or listen | ||||
// by default. | // by default. | ||||
if (gArgs.SoftSetBoolArg("-dnsseed", false)) { | if (gArgs.SoftSetBoolArg("-dnsseed", false)) { | ||||
LogPrintf("%s: parameter interaction: -connect set -> setting " | LogPrint(BCLog::NET, | ||||
"%s: parameter interaction: -connect set -> setting " | |||||
"-dnsseed=0\n", | "-dnsseed=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
if (gArgs.SoftSetBoolArg("-listen", false)) { | if (gArgs.SoftSetBoolArg("-listen", false)) { | ||||
LogPrintf("%s: parameter interaction: -connect set -> setting " | LogPrint(BCLog::NET, | ||||
"%s: parameter interaction: -connect set -> setting " | |||||
"-listen=0\n", | "-listen=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
} | } | ||||
if (gArgs.IsArgSet("-proxy")) { | if (gArgs.IsArgSet("-proxy")) { | ||||
// to protect privacy, do not listen by default if a default proxy | // to protect privacy, do not listen by default if a default proxy | ||||
// server is specified. | // server is specified. | ||||
if (gArgs.SoftSetBoolArg("-listen", false)) { | if (gArgs.SoftSetBoolArg("-listen", false)) { | ||||
LogPrintf( | LogPrint( | ||||
BCLog::PROXY, | |||||
"%s: parameter interaction: -proxy set -> setting -listen=0\n", | "%s: parameter interaction: -proxy set -> setting -listen=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
// to protect privacy, do not use UPNP when a proxy is set. The user may | // to protect privacy, do not use UPNP when a proxy is set. The user may | ||||
// still specify -listen=1 to listen locally, so don't rely on this | // still specify -listen=1 to listen locally, so don't rely on this | ||||
// happening through -listen below. | // happening through -listen below. | ||||
if (gArgs.SoftSetBoolArg("-upnp", false)) { | if (gArgs.SoftSetBoolArg("-upnp", false)) { | ||||
LogPrintf( | LogPrint( | ||||
BCLog::PROXY, | |||||
"%s: parameter interaction: -proxy set -> setting -upnp=0\n", | "%s: parameter interaction: -proxy set -> setting -upnp=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
// to protect privacy, do not discover addresses by default | // to protect privacy, do not discover addresses by default | ||||
if (gArgs.SoftSetBoolArg("-discover", false)) { | if (gArgs.SoftSetBoolArg("-discover", false)) { | ||||
LogPrintf("%s: parameter interaction: -proxy set -> setting " | LogPrint(BCLog::PROXY, | ||||
"%s: parameter interaction: -proxy set -> setting " | |||||
"-discover=0\n", | "-discover=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
} | } | ||||
if (!gArgs.GetBoolArg("-listen", DEFAULT_LISTEN)) { | if (!gArgs.GetBoolArg("-listen", DEFAULT_LISTEN)) { | ||||
// do not map ports or try to retrieve public IP when not listening | // do not map ports or try to retrieve public IP when not listening | ||||
// (pointless) | // (pointless) | ||||
if (gArgs.SoftSetBoolArg("-upnp", false)) { | if (gArgs.SoftSetBoolArg("-upnp", false)) { | ||||
LogPrintf( | LogPrint( | ||||
BCLog::NET, | |||||
"%s: parameter interaction: -listen=0 -> setting -upnp=0\n", | "%s: parameter interaction: -listen=0 -> setting -upnp=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
if (gArgs.SoftSetBoolArg("-discover", false)) { | if (gArgs.SoftSetBoolArg("-discover", false)) { | ||||
LogPrintf( | LogPrint( | ||||
BCLog::NET, | |||||
"%s: parameter interaction: -listen=0 -> setting -discover=0\n", | "%s: parameter interaction: -listen=0 -> setting -discover=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
if (gArgs.SoftSetBoolArg("-listenonion", false)) { | if (gArgs.SoftSetBoolArg("-listenonion", false)) { | ||||
LogPrintf("%s: parameter interaction: -listen=0 -> setting " | LogPrint(BCLog::NET, | ||||
"%s: parameter interaction: -listen=0 -> setting " | |||||
"-listenonion=0\n", | "-listenonion=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
} | } | ||||
if (gArgs.IsArgSet("-externalip")) { | if (gArgs.IsArgSet("-externalip")) { | ||||
// if an explicit public IP is specified, do not try to find others | // if an explicit public IP is specified, do not try to find others | ||||
if (gArgs.SoftSetBoolArg("-discover", false)) { | if (gArgs.SoftSetBoolArg("-discover", false)) { | ||||
LogPrintf("%s: parameter interaction: -externalip set -> setting " | LogPrint(BCLog::NET, | ||||
"%s: parameter interaction: -externalip set -> setting " | |||||
"-discover=0\n", | "-discover=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
} | } | ||||
// disable whitelistrelay in blocksonly mode | // disable whitelistrelay in blocksonly mode | ||||
if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY)) { | if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY)) { | ||||
if (gArgs.SoftSetBoolArg("-whitelistrelay", false)) { | if (gArgs.SoftSetBoolArg("-whitelistrelay", false)) { | ||||
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting " | LogPrint(BCLog::NET, | ||||
"%s: parameter interaction: -blocksonly=1 -> setting " | |||||
"-whitelistrelay=0\n", | "-whitelistrelay=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
} | } | ||||
// Forcing relay from whitelisted hosts implies we will accept relays from | // Forcing relay from whitelisted hosts implies we will accept relays from | ||||
// them in the first place. | // them in the first place. | ||||
if (gArgs.GetBoolArg("-whitelistforcerelay", DEFAULT_WHITELISTFORCERELAY)) { | if (gArgs.GetBoolArg("-whitelistforcerelay", DEFAULT_WHITELISTFORCERELAY)) { | ||||
if (gArgs.SoftSetBoolArg("-whitelistrelay", true)) { | if (gArgs.SoftSetBoolArg("-whitelistrelay", true)) { | ||||
LogPrintf("%s: parameter interaction: -whitelistforcerelay=1 -> " | LogPrint(BCLog::NET, | ||||
"%s: parameter interaction: -whitelistforcerelay=1 -> " | |||||
"setting -whitelistrelay=1\n", | "setting -whitelistrelay=1\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
static std::string ResolveErrMsg(const char *const optname, | static std::string ResolveErrMsg(const char *const optname, | ||||
const std::string &strBind) { | const std::string &strBind) { | ||||
return strprintf(_("Cannot resolve -%s address: '%s'"), optname, strBind); | return strprintf(_("Cannot resolve -%s address: '%s'"), optname, strBind); | ||||
} | } | ||||
void InitLogging() { | void InitLogging() { | ||||
BCLog::Logger &logger = GetLogger(); | BCLog::Logger &logger = GetLogger(); | ||||
logger.m_print_to_console = gArgs.GetBoolArg("-printtoconsole", false); | logger.m_print_to_console = gArgs.GetBoolArg("-printtoconsole", false); | ||||
logger.m_log_timestamps = | logger.m_log_timestamps = | ||||
gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS); | gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS); | ||||
logger.m_log_time_micros = | logger.m_log_time_micros = | ||||
gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS); | gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS); | ||||
fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS); | fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS); | ||||
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); | LogPrint(BCLog::INIT, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); | ||||
LogPrintf("%s version %s\n", CLIENT_NAME, FormatFullVersion()); | LogPrint(BCLog::INIT, "%s version %s\n", CLIENT_NAME, FormatFullVersion()); | ||||
} | } | ||||
namespace { // Variables internal to initialization process only | namespace { // Variables internal to initialization process only | ||||
int nMaxConnections; | int nMaxConnections; | ||||
int nUserMaxConnections; | int nUserMaxConnections; | ||||
int nFD; | int nFD; | ||||
ServiceFlags nLocalServices = NODE_NETWORK; | ServiceFlags nLocalServices = NODE_NETWORK; | ||||
} // namespace | } // namespace | ||||
[[noreturn]] static void new_handler_terminate() { | [[noreturn]] static void new_handler_terminate() { | ||||
// Rather than throwing std::bad-alloc if allocation fails, terminate | // Rather than throwing std::bad-alloc if allocation fails, terminate | ||||
// immediately to (try to) avoid chain corruption. Since LogPrintf may | // immediately to (try to) avoid chain corruption. Since LogPrint may | ||||
// itself allocate memory, set the handler directly to terminate first. | // itself allocate memory, set the handler directly to terminate first. | ||||
std::set_new_handler(std::terminate); | std::set_new_handler(std::terminate); | ||||
LogPrintf("Error: Out of memory. Terminating.\n"); | LogPrint(BCLog::INIT, "Error: Out of memory. Terminating.\n"); | ||||
// The log was successful, terminate now. | // The log was successful, terminate now. | ||||
std::terminate(); | std::terminate(); | ||||
}; | }; | ||||
bool AppInitBasicSetup() { | bool AppInitBasicSetup() { | ||||
// Step 1: setup | // Step 1: setup | ||||
#ifdef _MSC_VER | #ifdef _MSC_VER | ||||
▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | 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", | ||||
chainparams.GetConsensus().defaultAssumeValid.GetHex())); | chainparams.GetConsensus().defaultAssumeValid.GetHex())); | ||||
if (!hashAssumeValid.IsNull()) { | if (!hashAssumeValid.IsNull()) { | ||||
LogPrintf("Assuming ancestors of block %s have valid signatures.\n", | LogPrint(BCLog::INIT, | ||||
"Assuming ancestors of block %s have valid signatures.\n", | |||||
hashAssumeValid.GetHex()); | hashAssumeValid.GetHex()); | ||||
} else { | } else { | ||||
LogPrintf("Validating signatures for all blocks.\n"); | LogPrint(BCLog::INIT, "Validating signatures for all blocks.\n"); | ||||
} | } | ||||
if (gArgs.IsArgSet("-minimumchainwork")) { | if (gArgs.IsArgSet("-minimumchainwork")) { | ||||
const std::string minChainWorkStr = | const std::string minChainWorkStr = | ||||
gArgs.GetArg("-minimumchainwork", ""); | gArgs.GetArg("-minimumchainwork", ""); | ||||
if (!IsHexNumber(minChainWorkStr)) { | if (!IsHexNumber(minChainWorkStr)) { | ||||
return InitError(strprintf( | return InitError(strprintf( | ||||
"Invalid non-hex (%s) minimum chain work value specified", | "Invalid non-hex (%s) minimum chain work value specified", | ||||
minChainWorkStr)); | minChainWorkStr)); | ||||
} | } | ||||
nMinimumChainWork = UintToArith256(uint256S(minChainWorkStr)); | nMinimumChainWork = UintToArith256(uint256S(minChainWorkStr)); | ||||
} else { | } else { | ||||
nMinimumChainWork = | nMinimumChainWork = | ||||
UintToArith256(chainparams.GetConsensus().nMinimumChainWork); | UintToArith256(chainparams.GetConsensus().nMinimumChainWork); | ||||
} | } | ||||
LogPrintf("Setting nMinimumChainWork=%s\n", nMinimumChainWork.GetHex()); | LogPrint(BCLog::INIT, "Setting nMinimumChainWork=%s\n", | ||||
nMinimumChainWork.GetHex()); | |||||
if (nMinimumChainWork < | if (nMinimumChainWork < | ||||
UintToArith256(chainparams.GetConsensus().nMinimumChainWork)) { | UintToArith256(chainparams.GetConsensus().nMinimumChainWork)) { | ||||
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", | LogPrint(BCLog::INIT, | ||||
"Warning: nMinimumChainWork set below default value of %s\n", | |||||
chainparams.GetConsensus().nMinimumChainWork.GetHex()); | chainparams.GetConsensus().nMinimumChainWork.GetHex()); | ||||
} | } | ||||
// mempool limits | // mempool limits | ||||
int64_t nMempoolSizeMax = | int64_t nMempoolSizeMax = | ||||
gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; | gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; | ||||
int64_t nMempoolSizeMin = | int64_t nMempoolSizeMin = | ||||
gArgs.GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * | gArgs.GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * | ||||
1000 * 40; | 1000 * 40; | ||||
Show All 35 Lines | bool AppInitParameterInteraction(Config &config, RPCServer &rpcServer) { | ||||
int64_t nPruneArg = gArgs.GetArg("-prune", 0); | int64_t nPruneArg = gArgs.GetArg("-prune", 0); | ||||
if (nPruneArg < 0) { | if (nPruneArg < 0) { | ||||
return InitError( | return InitError( | ||||
_("Prune cannot be configured with a negative value.")); | _("Prune cannot be configured with a negative value.")); | ||||
} | } | ||||
nPruneTarget = (uint64_t)nPruneArg * 1024 * 1024; | nPruneTarget = (uint64_t)nPruneArg * 1024 * 1024; | ||||
if (nPruneArg == 1) { | if (nPruneArg == 1) { | ||||
// manual pruning: -prune=1 | // manual pruning: -prune=1 | ||||
LogPrintf("Block pruning enabled. Use RPC call " | LogPrint(BCLog::PRUNE, | ||||
"Block pruning enabled. Use RPC call " | |||||
"pruneblockchain(height) to manually prune block and undo " | "pruneblockchain(height) to manually prune block and undo " | ||||
"files.\n"); | "files.\n"); | ||||
nPruneTarget = std::numeric_limits<uint64_t>::max(); | nPruneTarget = std::numeric_limits<uint64_t>::max(); | ||||
fPruneMode = true; | fPruneMode = true; | ||||
} else if (nPruneTarget) { | } else if (nPruneTarget) { | ||||
if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) { | if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) { | ||||
return InitError( | return InitError( | ||||
strprintf(_("Prune configured below the minimum of %d MiB. " | strprintf(_("Prune configured below the minimum of %d MiB. " | ||||
"Please use a higher number."), | "Please use a higher number."), | ||||
MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024)); | MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024)); | ||||
} | } | ||||
LogPrintf("Prune configured to target %uMiB on disk for block and undo " | LogPrint(BCLog::PRUNE, | ||||
"Prune configured to target %uMiB on disk for block and undo " | |||||
"files.\n", | "files.\n", | ||||
nPruneTarget / 1024 / 1024); | nPruneTarget / 1024 / 1024); | ||||
fPruneMode = true; | fPruneMode = true; | ||||
} | } | ||||
RegisterAllRPCCommands(config, rpcServer, tableRPC); | RegisterAllRPCCommands(config, rpcServer, tableRPC); | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
RegisterWalletRPCCommands(tableRPC); | RegisterWalletRPCCommands(tableRPC); | ||||
RegisterDumpRPCCommands(tableRPC); | RegisterDumpRPCCommands(tableRPC); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | static bool LockDataDirectory(bool probeOnly) { | ||||
return true; | return true; | ||||
} | } | ||||
bool AppInitSanityChecks() { | bool AppInitSanityChecks() { | ||||
// Step 4: sanity checks | // Step 4: sanity checks | ||||
// Initialize elliptic curve code | // Initialize elliptic curve code | ||||
std::string sha256_algo = SHA256AutoDetect(); | std::string sha256_algo = SHA256AutoDetect(); | ||||
LogPrintf("Using the '%s' SHA256 implementation\n", sha256_algo); | LogPrint(BCLog::INIT, "Using the '%s' SHA256 implementation\n", | ||||
sha256_algo); | |||||
RandomInit(); | RandomInit(); | ||||
ECC_Start(); | ECC_Start(); | ||||
globalVerifyHandle.reset(new ECCVerifyHandle()); | globalVerifyHandle.reset(new ECCVerifyHandle()); | ||||
// Sanity check | // Sanity check | ||||
if (!InitSanityCheck()) { | if (!InitSanityCheck()) { | ||||
return InitError(strprintf( | return InitError(strprintf( | ||||
_("Initialization sanity check failed. %s is shutting down."), | _("Initialization sanity check failed. %s is shutting down."), | ||||
Show All 37 Lines | if (gArgs.GetBoolArg("-shrinkdebugfile", default_shrinkdebugfile)) { | ||||
logger.ShrinkDebugFile(); | logger.ShrinkDebugFile(); | ||||
} | } | ||||
if (logger.m_print_to_file) { | if (logger.m_print_to_file) { | ||||
logger.OpenDebugLog(); | logger.OpenDebugLog(); | ||||
} | } | ||||
if (!logger.m_log_timestamps) { | if (!logger.m_log_timestamps) { | ||||
LogPrintf("Startup time: %s\n", | LogPrint(BCLog::INIT, "Startup time: %s\n", | ||||
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime())); | DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime())); | ||||
} | } | ||||
LogPrintf("Default data directory %s\n", GetDefaultDataDir().string()); | LogPrint(BCLog::INIT, "Default data directory %s\n", | ||||
LogPrintf("Using data directory %s\n", GetDataDir().string()); | GetDefaultDataDir().string()); | ||||
LogPrintf( | LogPrint(BCLog::INIT, "Using data directory %s\n", GetDataDir().string()); | ||||
"Using config file %s\n", | LogPrint( | ||||
BCLog::INIT, "Using config file %s\n", | |||||
GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)).string()); | GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)).string()); | ||||
LogPrintf("Using at most %i automatic connections (%i file descriptors " | LogPrint(BCLog::INIT, | ||||
"Using at most %i automatic connections (%i file descriptors " | |||||
"available)\n", | "available)\n", | ||||
nMaxConnections, nFD); | nMaxConnections, nFD); | ||||
InitSignatureCache(); | InitSignatureCache(); | ||||
InitScriptExecutionCache(); | InitScriptExecutionCache(); | ||||
LogPrintf("Using %u threads for script verification\n", | LogPrint(BCLog::INIT, "Using %u threads for script verification\n", | ||||
nScriptCheckThreads); | nScriptCheckThreads); | ||||
if (nScriptCheckThreads) { | if (nScriptCheckThreads) { | ||||
for (int i = 0; i < nScriptCheckThreads - 1; i++) { | for (int i = 0; i < nScriptCheckThreads - 1; i++) { | ||||
threadGroup.create_thread(&ThreadScriptCheck); | threadGroup.create_thread(&ThreadScriptCheck); | ||||
} | } | ||||
} | } | ||||
// Start the lightweight task scheduler thread | // Start the lightweight task scheduler thread | ||||
CScheduler::Function serviceLoop = | CScheduler::Function serviceLoop = | ||||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | int64_t nCoinDBCache = | ||||
std::min(nTotalCache / 2, (nTotalCache / 4) + (1 << 23)); | std::min(nTotalCache / 2, (nTotalCache / 4) + (1 << 23)); | ||||
// cap total coins db cache | // cap total coins db cache | ||||
nCoinDBCache = std::min(nCoinDBCache, nMaxCoinsDBCache << 20); | nCoinDBCache = std::min(nCoinDBCache, nMaxCoinsDBCache << 20); | ||||
nTotalCache -= nCoinDBCache; | nTotalCache -= nCoinDBCache; | ||||
// the rest goes to in-memory cache | // the rest goes to in-memory cache | ||||
nCoinCacheUsage = nTotalCache; | nCoinCacheUsage = nTotalCache; | ||||
int64_t nMempoolSizeMax = | int64_t nMempoolSizeMax = | ||||
gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; | gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; | ||||
LogPrintf("Cache configuration:\n"); | LogPrint(BCLog::MEMPOOL, "Cache configuration:\n"); | ||||
LogPrintf("* Using %.1fMiB for block index database\n", | LogPrint(BCLog::MEMPOOL, "* Using %.1fMiB for block index database\n", | ||||
nBlockTreeDBCache * (1.0 / 1024 / 1024)); | nBlockTreeDBCache * (1.0 / 1024 / 1024)); | ||||
LogPrintf("* Using %.1fMiB for chain state database\n", | LogPrint(BCLog::MEMPOOL, "* Using %.1fMiB for chain state database\n", | ||||
nCoinDBCache * (1.0 / 1024 / 1024)); | nCoinDBCache * (1.0 / 1024 / 1024)); | ||||
LogPrintf("* Using %.1fMiB for in-memory UTXO set (plus up to %.1fMiB of " | LogPrint(BCLog::MEMPOOL, | ||||
"* Using %.1fMiB for in-memory UTXO set (plus up to %.1fMiB of " | |||||
"unused mempool space)\n", | "unused mempool space)\n", | ||||
nCoinCacheUsage * (1.0 / 1024 / 1024), | nCoinCacheUsage * (1.0 / 1024 / 1024), | ||||
nMempoolSizeMax * (1.0 / 1024 / 1024)); | nMempoolSizeMax * (1.0 / 1024 / 1024)); | ||||
int64_t nStart = 0; | int64_t nStart = 0; | ||||
bool fLoaded = false; | bool fLoaded = false; | ||||
while (!fLoaded && !fRequestShutdown) { | while (!fLoaded && !fRequestShutdown) { | ||||
bool fReset = fReindex; | bool fReset = fReindex; | ||||
std::string strLoadError; | std::string strLoadError; | ||||
uiInterface.InitMessage(_("Loading block index...")); | uiInterface.InitMessage(_("Loading block index...")); | ||||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | while (!fLoaded && !fRequestShutdown) { | ||||
} | } | ||||
} | } | ||||
if (!fReindex && !fReindexChainState) { | if (!fReindex && !fReindexChainState) { | ||||
uiInterface.InitMessage(_("Verifying blocks...")); | uiInterface.InitMessage(_("Verifying blocks...")); | ||||
if (fHavePruned && | if (fHavePruned && | ||||
gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS) > | gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS) > | ||||
MIN_BLOCKS_TO_KEEP) { | MIN_BLOCKS_TO_KEEP) { | ||||
LogPrintf("Prune: pruned datadir may not have more " | LogPrint(BCLog::PRUNE, | ||||
"Prune: pruned datadir may not have more " | |||||
"than %d blocks; only checking available " | "than %d blocks; only checking available " | ||||
"blocks", | "blocks", | ||||
MIN_BLOCKS_TO_KEEP); | MIN_BLOCKS_TO_KEEP); | ||||
} | } | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
CBlockIndex *tip = chainActive.Tip(); | CBlockIndex *tip = chainActive.Tip(); | ||||
RPCNotifyBlockChange(true, tip); | RPCNotifyBlockChange(true, tip); | ||||
if (tip && | if (tip && | ||||
tip->nTime > | tip->nTime > | ||||
Show All 14 Lines | while (!fLoaded && !fRequestShutdown) { | ||||
gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL), | gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL), | ||||
gArgs.GetArg("-checkblocks", | gArgs.GetArg("-checkblocks", | ||||
DEFAULT_CHECKBLOCKS))) { | DEFAULT_CHECKBLOCKS))) { | ||||
strLoadError = _("Corrupted block database detected"); | strLoadError = _("Corrupted block database detected"); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} catch (const std::exception &e) { | } catch (const std::exception &e) { | ||||
LogPrintf("%s\n", e.what()); | LogPrint(BCLog::INIT, "%s\n", e.what()); | ||||
strLoadError = _("Error opening block database"); | strLoadError = _("Error opening block database"); | ||||
break; | break; | ||||
} | } | ||||
fLoaded = true; | fLoaded = true; | ||||
} while (false); | } while (false); | ||||
if (!fLoaded && !fRequestShutdown) { | if (!fLoaded && !fRequestShutdown) { | ||||
// first suggest a reindex | // first suggest a reindex | ||||
if (!fReset) { | if (!fReset) { | ||||
bool fRet = uiInterface.ThreadSafeQuestion( | bool fRet = uiInterface.ThreadSafeQuestion( | ||||
strLoadError + ".\n\n" + | strLoadError + ".\n\n" + | ||||
_("Do you want to rebuild the block database now?"), | _("Do you want to rebuild the block database now?"), | ||||
strLoadError + ".\nPlease restart with -reindex or " | strLoadError + ".\nPlease restart with -reindex or " | ||||
"-reindex-chainstate to recover.", | "-reindex-chainstate to recover.", | ||||
"", | "", | ||||
CClientUIInterface::MSG_ERROR | | CClientUIInterface::MSG_ERROR | | ||||
CClientUIInterface::BTN_ABORT); | CClientUIInterface::BTN_ABORT); | ||||
if (fRet) { | if (fRet) { | ||||
fReindex = true; | fReindex = true; | ||||
fRequestShutdown = false; | fRequestShutdown = false; | ||||
} else { | } else { | ||||
LogPrintf("Aborted block database rebuild. Exiting.\n"); | LogPrint(BCLog::INIT, | ||||
"Aborted block database rebuild. Exiting.\n"); | |||||
return false; | return false; | ||||
} | } | ||||
} else { | } else { | ||||
return InitError(strLoadError); | return InitError(strLoadError); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// As LoadBlockIndex can take several minutes, it's possible the user | // As LoadBlockIndex can take several minutes, it's possible the user | ||||
// requested to kill the GUI during the last operation. If so, exit. | // requested to kill the GUI during the last operation. If so, exit. | ||||
// As the program has not fully started yet, Shutdown() is possibly | // As the program has not fully started yet, Shutdown() is possibly | ||||
// overkill. | // overkill. | ||||
if (fRequestShutdown) { | if (fRequestShutdown) { | ||||
LogPrintf("Shutdown requested. Exiting.\n"); | LogPrint(BCLog::INIT, "Shutdown requested. Exiting.\n"); | ||||
return false; | return false; | ||||
} | } | ||||
LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart); | LogPrint(BCLog::INIT, " 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); | 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)); | ||||
// Step 8: load wallet | // Step 8: load wallet | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
if (!InitLoadWallet(chainparams)) { | if (!InitLoadWallet(chainparams)) { | ||||
return false; | return false; | ||||
} | } | ||||
#else | #else | ||||
LogPrintf("No wallet support compiled in!\n"); | LogPrint(BCLog::WALLET, "No wallet support compiled in!\n"); | ||||
#endif | #endif | ||||
// Step 9: data directory maintenance | // Step 9: data directory maintenance | ||||
// if pruning, unset the service bit and perform the initial blockstore | // if pruning, unset the service bit and perform the initial blockstore | ||||
// prune after any wallet rescanning has taken place. | // prune after any wallet rescanning has taken place. | ||||
if (fPruneMode) { | if (fPruneMode) { | ||||
LogPrintf("Unsetting NODE_NETWORK on prune mode\n"); | LogPrint(BCLog::PRUNE, "Unsetting NODE_NETWORK on prune mode\n"); | ||||
nLocalServices = ServiceFlags(nLocalServices & ~NODE_NETWORK); | nLocalServices = ServiceFlags(nLocalServices & ~NODE_NETWORK); | ||||
if (!fReindex) { | if (!fReindex) { | ||||
uiInterface.InitMessage(_("Pruning blockstore...")); | uiInterface.InitMessage(_("Pruning blockstore...")); | ||||
PruneAndFlush(); | PruneAndFlush(); | ||||
} | } | ||||
} | } | ||||
// Step 10: import blocks | // Step 10: import blocks | ||||
Show All 32 Lines | // Wait for genesis block to be processed | ||||
condvar_GenesisWait.wait_for(lock, std::chrono::milliseconds(500)); | condvar_GenesisWait.wait_for(lock, std::chrono::milliseconds(500)); | ||||
} | } | ||||
uiInterface.NotifyBlockTip.disconnect(BlockNotifyGenesisWait); | uiInterface.NotifyBlockTip.disconnect(BlockNotifyGenesisWait); | ||||
} | } | ||||
// Step 11: start node | // Step 11: start node | ||||
//// debug print | //// debug print | ||||
LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size()); | LogPrint(BCLog::INIT, "mapBlockIndex.size() = %u\n", mapBlockIndex.size()); | ||||
LogPrintf("nBestHeight = %d\n", chainActive.Height()); | LogPrint(BCLog::INIT, "nBestHeight = %d\n", chainActive.Height()); | ||||
if (gArgs.GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) { | if (gArgs.GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) { | ||||
StartTorControl(); | StartTorControl(); | ||||
} | } | ||||
Discover(); | Discover(); | ||||
// Map ports with UPnP | // Map ports with UPnP | ||||
if (gArgs.GetBoolArg("-upnp", DEFAULT_UPNP)) { | if (gArgs.GetBoolArg("-upnp", DEFAULT_UPNP)) { | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |