Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,688 Lines • ▼ Show 20 Lines | bool AppInitParameterInteraction(Config &config) { | ||||
for (const auto &arg : gArgs.GetUnsuitableSectionOnlyArgs()) { | for (const auto &arg : gArgs.GetUnsuitableSectionOnlyArgs()) { | ||||
return InitError(strprintf(_("Config setting for %s only applied on %s " | return InitError(strprintf(_("Config setting for %s only applied on %s " | ||||
"network when in [%s] section."), | "network when in [%s] section."), | ||||
arg, network, network)); | arg, network, network)); | ||||
} | } | ||||
// Warn if unrecognized section name are present in the config file. | // Warn if unrecognized section name are present in the config file. | ||||
for (const auto §ion : gArgs.GetUnrecognizedSections()) { | for (const auto §ion : gArgs.GetUnrecognizedSections()) { | ||||
InitWarning(strprintf( | InitWarning(strprintf(Untranslated("%s:%i ") + | ||||
"%s:%i " + _("Section [%s] is not recognized.").translated, | _("Section [%s] is not recognized."), | ||||
section.m_file, section.m_line, section.m_name)); | section.m_file, section.m_line, section.m_name)); | ||||
} | } | ||||
if (!fs::is_directory(GetBlocksDir())) { | if (!fs::is_directory(GetBlocksDir())) { | ||||
return InitError( | return InitError( | ||||
strprintf(_("Specified blocks directory \"%s\" does not exist."), | strprintf(_("Specified blocks directory \"%s\" does not exist."), | ||||
gArgs.GetArg("-blocksdir", ""))); | gArgs.GetArg("-blocksdir", ""))); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | if (gArgs.IsArgSet("-debug")) { | ||||
// Special-case: if -debug=0/-nodebug is set, turn off debugging | // Special-case: if -debug=0/-nodebug is set, turn off debugging | ||||
// messages | // messages | ||||
const std::vector<std::string> &categories = gArgs.GetArgs("-debug"); | const std::vector<std::string> &categories = gArgs.GetArgs("-debug"); | ||||
if (std::none_of( | if (std::none_of( | ||||
categories.begin(), categories.end(), | categories.begin(), categories.end(), | ||||
[](std::string cat) { return cat == "0" || cat == "none"; })) { | [](std::string cat) { return cat == "0" || cat == "none"; })) { | ||||
for (const auto &cat : categories) { | for (const auto &cat : categories) { | ||||
if (!LogInstance().EnableCategory(cat)) { | if (!LogInstance().EnableCategory(cat)) { | ||||
InitWarning(strprintf( | InitWarning( | ||||
_("Unsupported logging category %s=%s.").translated, | strprintf(_("Unsupported logging category %s=%s."), | ||||
"-debug", cat)); | "-debug", cat)); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// Now remove the logging categories which were explicitly excluded | // Now remove the logging categories which were explicitly excluded | ||||
for (const std::string &cat : gArgs.GetArgs("-debugexclude")) { | for (const std::string &cat : gArgs.GetArgs("-debugexclude")) { | ||||
if (!LogInstance().DisableCategory(cat)) { | if (!LogInstance().DisableCategory(cat)) { | ||||
InitWarning( | InitWarning(strprintf(_("Unsupported logging category %s=%s."), | ||||
strprintf(_("Unsupported logging category %s=%s.").translated, | |||||
"-debugexclude", cat)); | "-debugexclude", cat)); | ||||
} | } | ||||
} | } | ||||
// 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), | ||||
▲ Show 20 Lines • Show All 276 Lines • ▼ Show 20 Lines | bool AppInitMain(Config &config, RPCServer &rpcServer, | ||||
// Only log conf file usage message if conf file actually exists. | // Only log conf file usage message if conf file actually exists. | ||||
fs::path config_file_path = | fs::path config_file_path = | ||||
GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); | GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); | ||||
if (fs::exists(config_file_path)) { | if (fs::exists(config_file_path)) { | ||||
LogPrintf("Config file: %s\n", config_file_path.string()); | LogPrintf("Config file: %s\n", config_file_path.string()); | ||||
} else if (gArgs.IsArgSet("-conf")) { | } else if (gArgs.IsArgSet("-conf")) { | ||||
// Warn if no conf file exists at path provided by user | // Warn if no conf file exists at path provided by user | ||||
InitWarning(strprintf( | InitWarning( | ||||
_("The specified config file %s does not exist\n").translated, | strprintf(_("The specified config file %s does not exist\n"), | ||||
config_file_path.string())); | config_file_path.string())); | ||||
} else { | } else { | ||||
// Not categorizing as "Warning" because it's the default behavior | // Not categorizing as "Warning" because it's the default behavior | ||||
LogPrintf("Config file: %s (not found, skipping)\n", | LogPrintf("Config file: %s (not found, skipping)\n", | ||||
config_file_path.string()); | config_file_path.string()); | ||||
} | } | ||||
// Log the config arguments to debug.log | // Log the config arguments to debug.log | ||||
gArgs.LogArgs(); | gArgs.LogArgs(); | ||||
▲ Show 20 Lines • Show All 796 Lines • Show Last 20 Lines |