Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show All 17 Lines | |||||
#include <chain.h> | #include <chain.h> | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <checkpoints.h> | #include <checkpoints.h> | ||||
#include <compat/sanity.h> | #include <compat/sanity.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <consensus/validation.h> | #include <consensus/validation.h> | ||||
#include <flatfile.h> | #include <flatfile.h> | ||||
#include <fs.h> | #include <fs.h> | ||||
#include <hash.h> | |||||
#include <httprpc.h> | #include <httprpc.h> | ||||
#include <httpserver.h> | #include <httpserver.h> | ||||
#include <index/blockfilterindex.h> | #include <index/blockfilterindex.h> | ||||
#include <index/txindex.h> | #include <index/txindex.h> | ||||
#include <interfaces/chain.h> | #include <interfaces/chain.h> | ||||
#include <key.h> | #include <key.h> | ||||
#include <miner.h> | #include <miner.h> | ||||
#include <net.h> | #include <net.h> | ||||
Show All 13 Lines | |||||
#include <script/sigcache.h> | #include <script/sigcache.h> | ||||
#include <script/standard.h> | #include <script/standard.h> | ||||
#include <shutdown.h> | #include <shutdown.h> | ||||
#include <timedata.h> | #include <timedata.h> | ||||
#include <torcontrol.h> | #include <torcontrol.h> | ||||
#include <txdb.h> | #include <txdb.h> | ||||
#include <txmempool.h> | #include <txmempool.h> | ||||
#include <ui_interface.h> | #include <ui_interface.h> | ||||
#include <util/asmap.h> | |||||
#include <util/moneystr.h> | #include <util/moneystr.h> | ||||
#include <util/threadnames.h> | #include <util/threadnames.h> | ||||
#include <util/translation.h> | #include <util/translation.h> | ||||
#include <util/validation.h> | #include <util/validation.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
#include <walletinitinterface.h> | #include <walletinitinterface.h> | ||||
Show All 24 Lines | |||||
#ifdef WIN32 | #ifdef WIN32 | ||||
// Win32 LevelDB doesn't use filedescriptors, and the ones used for accessing | // Win32 LevelDB doesn't use filedescriptors, and the ones used for accessing | ||||
// block files don't count towards the fd_set size limit anyway. | // block files don't count towards the fd_set size limit anyway. | ||||
#define MIN_CORE_FILEDESCRIPTORS 0 | #define MIN_CORE_FILEDESCRIPTORS 0 | ||||
#else | #else | ||||
#define MIN_CORE_FILEDESCRIPTORS 150 | #define MIN_CORE_FILEDESCRIPTORS 150 | ||||
#endif | #endif | ||||
static const char *DEFAULT_ASMAP_FILENAME = "ip_asn.map"; | |||||
/** | /** | ||||
* The PID file facilities. | * The PID file facilities. | ||||
*/ | */ | ||||
static const char *BITCOIN_PID_FILENAME = "bitcoind.pid"; | static const char *BITCOIN_PID_FILENAME = "bitcoind.pid"; | ||||
static fs::path GetPidFile() { | static fs::path GetPidFile() { | ||||
return AbsPathForConfigVal( | return AbsPathForConfigVal( | ||||
fs::path(gArgs.GetArg("-pid", BITCOIN_PID_FILENAME))); | fs::path(gArgs.GetArg("-pid", BITCOIN_PID_FILENAME))); | ||||
▲ Show 20 Lines • Show All 602 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 2,039 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; | |||||
} | |||||
node.connman->SetAsmap(asmap); | |||||
const uint256 asmap_version = SerializeHash(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 |