Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 573 Lines • ▼ Show 20 Lines | gArgs.AddArg("-usecashaddr", | ||||
"(activate by default on Jan, 14)", | "(activate by default on Jan, 14)", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-addnode=<ip>", | gArgs.AddArg("-addnode=<ip>", | ||||
"Add a node to connect to and attempt to keep the connection " | "Add a node to connect to and attempt to keep the connection " | ||||
"open (see the `addnode` RPC command help for more info)", | "open (see the `addnode` RPC command help for more info)", | ||||
ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, | ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, | ||||
OptionsCategory::CONNECTION); | OptionsCategory::CONNECTION); | ||||
gArgs.AddArg("-asmap=<file>", | |||||
strprintf("Specify asn mapping used for bucketing of the " | |||||
"peers (default: %s). Relative paths will be " | |||||
"prefixed by the net-specific datadir location.", | |||||
DEFAULT_ASMAP_FILENAME), | |||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | |||||
gArgs.AddArg("-banscore=<n>", | gArgs.AddArg("-banscore=<n>", | ||||
strprintf("Threshold for disconnecting and discouraging " | strprintf("Threshold for disconnecting and discouraging " | ||||
"misbehaving peers (default: %u)", | "misbehaving peers (default: %u)", | ||||
DEFAULT_BANSCORE_THRESHOLD), | DEFAULT_BANSCORE_THRESHOLD), | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ||||
gArgs.AddArg("-bantime=<n>", | gArgs.AddArg("-bantime=<n>", | ||||
strprintf("Default duration (in seconds) of manually " | strprintf("Default duration (in seconds) of manually " | ||||
"configured bans (default: %u)", | "configured bans (default: %u)", | ||||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | gArgs.AddArg( | ||||
strprintf( | strprintf( | ||||
"Tor control port to use if onion listening enabled (default: %s)", | "Tor control port to use if onion listening enabled (default: %s)", | ||||
DEFAULT_TOR_CONTROL), | DEFAULT_TOR_CONTROL), | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ||||
gArgs.AddArg("-torpassword=<pass>", | gArgs.AddArg("-torpassword=<pass>", | ||||
"Tor control port password (default: empty)", | "Tor control port password (default: empty)", | ||||
ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, | ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, | ||||
OptionsCategory::CONNECTION); | OptionsCategory::CONNECTION); | ||||
gArgs.AddArg("-asmap=<file>", | |||||
"Specify asn mapping used for bucketing of the peers. Path " | |||||
"should be relative to the -datadir path.", | |||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | |||||
#ifdef USE_UPNP | #ifdef USE_UPNP | ||||
#if USE_UPNP | #if USE_UPNP | ||||
gArgs.AddArg("-upnp", | gArgs.AddArg("-upnp", | ||||
"Use UPnP to map the listening port (default: 1 when " | "Use UPnP to map the listening port (default: 1 when " | ||||
"listening and no -proxy)", | "listening and no -proxy)", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ||||
#else | #else | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
▲ Show 20 Lines • Show All 1,574 Lines • ▼ Show 20 Lines | for (const std::string &strAddr : gArgs.GetArgs("-externalip")) { | ||||
addrLocal.IsValid()) { | addrLocal.IsValid()) { | ||||
AddLocal(addrLocal, LOCAL_MANUAL); | AddLocal(addrLocal, LOCAL_MANUAL); | ||||
} else { | } else { | ||||
return InitError( | return InitError( | ||||
Untranslated(ResolveErrMsg("externalip", strAddr))); | Untranslated(ResolveErrMsg("externalip", strAddr))); | ||||
} | } | ||||
} | } | ||||
// Read asmap file if configured | |||||
if (gArgs.IsArgSet("-asmap")) { | |||||
fs::path asmap_path = fs::path(gArgs.GetArg("-asmap", "")); | |||||
if (asmap_path.empty()) { | |||||
asmap_path = DEFAULT_ASMAP_FILENAME; | |||||
} | |||||
if (!asmap_path.is_absolute()) { | |||||
asmap_path = GetDataDir() / asmap_path; | |||||
} | |||||
if (!fs::exists(asmap_path)) { | |||||
InitError(strprintf(_("Could not find asmap file %s"), asmap_path)); | |||||
return false; | |||||
} | |||||
std::vector<bool> asmap = CAddrMan::DecodeAsmap(asmap_path); | |||||
if (asmap.size() == 0) { | |||||
InitError( | |||||
strprintf(_("Could not parse asmap file %s"), asmap_path)); | |||||
return false; | |||||
} | |||||
const uint256 asmap_version = SerializeHash(asmap); | |||||
node.connman->SetAsmap(std::move(asmap)); | |||||
LogPrintf("Using asmap version %s for IP bucketing\n", | |||||
asmap_version.ToString()); | |||||
} else { | |||||
LogPrintf("Using /16 prefix for IP bucketing\n"); | |||||
} | |||||
#if ENABLE_ZMQ | #if ENABLE_ZMQ | ||||
g_zmq_notification_interface = CZMQNotificationInterface::Create(); | g_zmq_notification_interface = CZMQNotificationInterface::Create(); | ||||
if (g_zmq_notification_interface) { | if (g_zmq_notification_interface) { | ||||
RegisterValidationInterface(g_zmq_notification_interface); | RegisterValidationInterface(g_zmq_notification_interface); | ||||
} | } | ||||
#endif | #endif | ||||
// unlimited unless -maxuploadtarget is set | // unlimited unless -maxuploadtarget is set | ||||
▲ Show 20 Lines • Show All 449 Lines • ▼ Show 20 Lines | if (!connOptions.m_use_addrman_outgoing) { | ||||
if (connect.size() != 1 || connect[0] != "0") { | if (connect.size() != 1 || connect[0] != "0") { | ||||
connOptions.m_specified_outgoing = connect; | connOptions.m_specified_outgoing = connect; | ||||
} | } | ||||
} | } | ||||
if (!node.connman->Start(*node.scheduler, connOptions)) { | if (!node.connman->Start(*node.scheduler, connOptions)) { | ||||
return false; | return false; | ||||
} | } | ||||
// Read asmap file if configured | |||||
if (gArgs.IsArgSet("-asmap")) { | |||||
std::string asmap_file = gArgs.GetArg("-asmap", ""); | |||||
if (asmap_file.empty()) { | |||||
asmap_file = DEFAULT_ASMAP_FILENAME; | |||||
} | |||||
const fs::path asmap_path = GetDataDir() / asmap_file; | |||||
std::vector<bool> asmap = CAddrMan::DecodeAsmap(asmap_path); | |||||
if (asmap.size() == 0) { | |||||
InitError( | |||||
strprintf(_("Could not find or parse specified asmap: '%s'"), | |||||
asmap_path)); | |||||
return false; | |||||
} | |||||
const uint256 asmap_version = SerializeHash(asmap); | |||||
node.connman->SetAsmap(std::move(asmap)); | |||||
LogPrintf("Using asmap version %s for IP bucketing.\n", | |||||
asmap_version.ToString()); | |||||
} else { | |||||
LogPrintf("Using /16 prefix for IP bucketing.\n"); | |||||
} | |||||
// Step 13: finished | // Step 13: finished | ||||
SetRPCWarmupFinished(); | SetRPCWarmupFinished(); | ||||
uiInterface.InitMessage(_("Done loading").translated); | uiInterface.InitMessage(_("Done loading").translated); | ||||
for (const auto &client : node.chain_clients) { | for (const auto &client : node.chain_clients) { | ||||
client->start(*node.scheduler); | client->start(*node.scheduler); | ||||
} | } | ||||
Show All 14 Lines |