|
|
@ -717,7 +717,7 @@ void InitParameterInteraction() |
|
|
|
LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__); |
|
|
|
LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) { |
|
|
|
if (mapMultiArgs.count("-connect") && mapMultiArgs.at("-connect").size() > 0) { |
|
|
|
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
|
|
|
|
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
|
|
|
|
if (SoftSetBoolArg("-dnsseed", false)) |
|
|
|
if (SoftSetBoolArg("-dnsseed", false)) |
|
|
|
LogPrintf("%s: parameter interaction: -connect set -> setting -dnsseed=0\n", __func__); |
|
|
|
LogPrintf("%s: parameter interaction: -connect set -> setting -dnsseed=0\n", __func__); |
|
|
@ -880,11 +880,13 @@ bool AppInitParameterInteraction() |
|
|
|
|
|
|
|
|
|
|
|
// ********************************************************* Step 3: parameter-to-internal-flags
|
|
|
|
// ********************************************************* Step 3: parameter-to-internal-flags
|
|
|
|
|
|
|
|
|
|
|
|
fDebug = !mapMultiArgs["-debug"].empty(); |
|
|
|
fDebug = mapMultiArgs.count("-debug"); |
|
|
|
// Special-case: if -debug=0/-nodebug is set, turn off debugging messages
|
|
|
|
// Special-case: if -debug=0/-nodebug is set, turn off debugging messages
|
|
|
|
const vector<string>& categories = mapMultiArgs["-debug"]; |
|
|
|
if (fDebug) { |
|
|
|
|
|
|
|
const vector<string>& categories = mapMultiArgs.at("-debug"); |
|
|
|
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end()) |
|
|
|
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end()) |
|
|
|
fDebug = false; |
|
|
|
fDebug = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check for -debugnet
|
|
|
|
// Check for -debugnet
|
|
|
|
if (GetBoolArg("-debugnet", false)) |
|
|
|
if (GetBoolArg("-debugnet", false)) |
|
|
@ -1003,12 +1005,12 @@ bool AppInitParameterInteraction() |
|
|
|
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end()); |
|
|
|
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!mapMultiArgs["-bip9params"].empty()) { |
|
|
|
if (mapMultiArgs.count("-bip9params")) { |
|
|
|
// Allow overriding BIP9 parameters for testing
|
|
|
|
// Allow overriding BIP9 parameters for testing
|
|
|
|
if (!chainparams.MineBlocksOnDemand()) { |
|
|
|
if (!chainparams.MineBlocksOnDemand()) { |
|
|
|
return InitError("BIP9 parameters may only be overridden on regtest."); |
|
|
|
return InitError("BIP9 parameters may only be overridden on regtest."); |
|
|
|
} |
|
|
|
} |
|
|
|
const vector<string>& deployments = mapMultiArgs["-bip9params"]; |
|
|
|
const vector<string>& deployments = mapMultiArgs.at("-bip9params"); |
|
|
|
for (auto i : deployments) { |
|
|
|
for (auto i : deployments) { |
|
|
|
std::vector<std::string> vDeploymentParams; |
|
|
|
std::vector<std::string> vDeploymentParams; |
|
|
|
boost::split(vDeploymentParams, i, boost::is_any_of(":")); |
|
|
|
boost::split(vDeploymentParams, i, boost::is_any_of(":")); |
|
|
@ -1154,11 +1156,13 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
|
|
|
|
|
|
|
|
// 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<string> uacomments; |
|
|
|
std::vector<string> uacomments; |
|
|
|
BOOST_FOREACH(string cmt, mapMultiArgs["-uacomment"]) |
|
|
|
if (mapMultiArgs.count("-uacomment")) { |
|
|
|
|
|
|
|
BOOST_FOREACH(string cmt, mapMultiArgs.at("-uacomment")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT)) |
|
|
|
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT)) |
|
|
|
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt)); |
|
|
|
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt)); |
|
|
|
uacomments.push_back(SanitizeString(cmt, SAFE_CHARS_UA_COMMENT)); |
|
|
|
uacomments.push_back(cmt); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments); |
|
|
|
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments); |
|
|
|
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) { |
|
|
|
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) { |
|
|
@ -1166,9 +1170,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
strSubVersion.size(), MAX_SUBVERSION_LENGTH)); |
|
|
|
strSubVersion.size(), MAX_SUBVERSION_LENGTH)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (mapArgs.count("-onlynet")) { |
|
|
|
if (mapMultiArgs.count("-onlynet")) { |
|
|
|
std::set<enum Network> nets; |
|
|
|
std::set<enum Network> nets; |
|
|
|
BOOST_FOREACH(const std::string& snet, mapMultiArgs["-onlynet"]) { |
|
|
|
BOOST_FOREACH(const std::string& snet, mapMultiArgs.at("-onlynet")) { |
|
|
|
enum Network net = ParseNetwork(snet); |
|
|
|
enum Network net = ParseNetwork(snet); |
|
|
|
if (net == NET_UNROUTABLE) |
|
|
|
if (net == NET_UNROUTABLE) |
|
|
|
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet)); |
|
|
|
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet)); |
|
|
@ -1181,8 +1185,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (mapArgs.count("-whitelist")) { |
|
|
|
if (mapMultiArgs.count("-whitelist")) { |
|
|
|
BOOST_FOREACH(const std::string& net, mapMultiArgs["-whitelist"]) { |
|
|
|
BOOST_FOREACH(const std::string& net, mapMultiArgs.at("-whitelist")) { |
|
|
|
CSubNet subnet; |
|
|
|
CSubNet subnet; |
|
|
|
LookupSubNet(net.c_str(), subnet); |
|
|
|
LookupSubNet(net.c_str(), subnet); |
|
|
|
if (!subnet.IsValid()) |
|
|
|
if (!subnet.IsValid()) |
|
|
@ -1234,14 +1238,16 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
|
|
|
|
|
|
|
|
if (fListen) { |
|
|
|
if (fListen) { |
|
|
|
bool fBound = false; |
|
|
|
bool fBound = false; |
|
|
|
if (mapArgs.count("-bind") || mapArgs.count("-whitebind")) { |
|
|
|
if (mapMultiArgs.count("-bind")) { |
|
|
|
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-bind"]) { |
|
|
|
BOOST_FOREACH(const std::string& strBind, mapMultiArgs.at("-bind")) { |
|
|
|
CService addrBind; |
|
|
|
CService addrBind; |
|
|
|
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) |
|
|
|
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) |
|
|
|
return InitError(ResolveErrMsg("bind", strBind)); |
|
|
|
return InitError(ResolveErrMsg("bind", strBind)); |
|
|
|
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR)); |
|
|
|
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR)); |
|
|
|
} |
|
|
|
} |
|
|
|
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-whitebind"]) { |
|
|
|
} |
|
|
|
|
|
|
|
if (mapMultiArgs.count("-whitebind")) { |
|
|
|
|
|
|
|
BOOST_FOREACH(const std::string& strBind, mapMultiArgs.at("-whitebind")) { |
|
|
|
CService addrBind; |
|
|
|
CService addrBind; |
|
|
|
if (!Lookup(strBind.c_str(), addrBind, 0, false)) |
|
|
|
if (!Lookup(strBind.c_str(), addrBind, 0, false)) |
|
|
|
return InitError(ResolveErrMsg("whitebind", strBind)); |
|
|
|
return InitError(ResolveErrMsg("whitebind", strBind)); |
|
|
@ -1250,7 +1256,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR | BF_WHITELIST)); |
|
|
|
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR | BF_WHITELIST)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
if (!mapMultiArgs.count("-bind") && !mapMultiArgs.count("-whitebind")) { |
|
|
|
struct in_addr inaddr_any; |
|
|
|
struct in_addr inaddr_any; |
|
|
|
inaddr_any.s_addr = INADDR_ANY; |
|
|
|
inaddr_any.s_addr = INADDR_ANY; |
|
|
|
fBound |= Bind(connman, CService(in6addr_any, GetListenPort()), BF_NONE); |
|
|
|
fBound |= Bind(connman, CService(in6addr_any, GetListenPort()), BF_NONE); |
|
|
@ -1260,8 +1266,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
return InitError(_("Failed to listen on any port. Use -listen=0 if you want this.")); |
|
|
|
return InitError(_("Failed to listen on any port. Use -listen=0 if you want this.")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (mapArgs.count("-externalip")) { |
|
|
|
if (mapMultiArgs.count("-externalip")) { |
|
|
|
BOOST_FOREACH(const std::string& strAddr, mapMultiArgs["-externalip"]) { |
|
|
|
BOOST_FOREACH(const std::string& strAddr, mapMultiArgs.at("-externalip")) { |
|
|
|
CService addrLocal; |
|
|
|
CService addrLocal; |
|
|
|
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid()) |
|
|
|
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid()) |
|
|
|
AddLocal(addrLocal, LOCAL_MANUAL); |
|
|
|
AddLocal(addrLocal, LOCAL_MANUAL); |
|
|
@ -1270,8 +1276,10 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"]) |
|
|
|
if (mapMultiArgs.count("-seednode")) { |
|
|
|
|
|
|
|
BOOST_FOREACH(const std::string& strDest, mapMultiArgs.at("-seednode")) |
|
|
|
connman.AddOneShot(strDest); |
|
|
|
connman.AddOneShot(strDest); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if ENABLE_ZMQ |
|
|
|
#if ENABLE_ZMQ |
|
|
|
pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs); |
|
|
|
pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs); |
|
|
@ -1519,9 +1527,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback); |
|
|
|
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback); |
|
|
|
|
|
|
|
|
|
|
|
std::vector<boost::filesystem::path> vImportFiles; |
|
|
|
std::vector<boost::filesystem::path> vImportFiles; |
|
|
|
if (mapArgs.count("-loadblock")) |
|
|
|
if (mapMultiArgs.count("-loadblock")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BOOST_FOREACH(const std::string& strFile, mapMultiArgs["-loadblock"]) |
|
|
|
BOOST_FOREACH(const std::string& strFile, mapMultiArgs.at("-loadblock")) |
|
|
|
vImportFiles.push_back(strFile); |
|
|
|
vImportFiles.push_back(strFile); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|