Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
#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/asmap.h> | ||||
#include <util/check.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 <validation.h> | #include <validation.h> | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
#include <walletinitinterface.h> | #include <walletinitinterface.h> | ||||
#include <boost/algorithm/string/classification.hpp> | #include <boost/algorithm/string/classification.hpp> | ||||
▲ Show 20 Lines • Show All 2,142 Lines • ▼ Show 20 Lines | 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())); | ||||
assert(!node.chainman); | assert(!node.chainman); | ||||
node.chainman = &g_chainman; | node.chainman = &g_chainman; | ||||
ChainstateManager &chainman = EnsureChainman(node); | ChainstateManager &chainman = *Assert(node.chainman); | ||||
node.peer_logic.reset( | node.peer_logic.reset(new PeerLogicValidation( | ||||
new PeerLogicValidation(node.connman.get(), node.banman.get(), | node.connman.get(), node.banman.get(), *node.scheduler, chainman)); | ||||
*node.scheduler, *node.chainman)); | |||||
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 665 Lines • Show Last 20 Lines |