Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 2,201 Lines • ▼ Show 20 Lines | #endif | ||||
node.banman = std::make_unique<BanMan>( | node.banman = std::make_unique<BanMan>( | ||||
GetDataDir() / "banlist.dat", config.GetChainParams(), &uiInterface, | GetDataDir() / "banlist.dat", config.GetChainParams(), &uiInterface, | ||||
gArgs.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME)); | gArgs.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME)); | ||||
assert(!node.connman); | assert(!node.connman); | ||||
node.connman = std::make_unique<CConnman>( | node.connman = std::make_unique<CConnman>( | ||||
config, GetRand(std::numeric_limits<uint64_t>::max()), | config, GetRand(std::numeric_limits<uint64_t>::max()), | ||||
GetRand(std::numeric_limits<uint64_t>::max())); | GetRand(std::numeric_limits<uint64_t>::max())); | ||||
node.peer_logic.reset(new PeerLogicValidation( | node.peer_logic.reset( | ||||
node.connman.get(), node.banman.get(), *node.scheduler)); | new PeerLogicValidation(node.connman.get(), node.banman.get())); | ||||
RegisterValidationInterface(node.peer_logic.get()); | RegisterValidationInterface(node.peer_logic.get()); | ||||
// sanitize comments per BIP-0014, format user agent and check total size | // sanitize comments per BIP-0014, format user agent and check total size | ||||
std::vector<std::string> uacomments; | std::vector<std::string> uacomments; | ||||
for (const std::string &cmt : gArgs.GetArgs("-uacomment")) { | for (const std::string &cmt : gArgs.GetArgs("-uacomment")) { | ||||
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT)) { | if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT)) { | ||||
return InitError(strprintf( | return InitError(strprintf( | ||||
_("User Agent comment (%s) contains unsafe characters."), cmt)); | _("User Agent comment (%s) contains unsafe characters."), cmt)); | ||||
▲ Show 20 Lines • Show All 597 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; | ||||
} | } | ||||
node.peer_logic->Start(*node.scheduler); | |||||
// 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 |