|
|
@ -880,9 +880,7 @@ bool AppInitParameterInteraction() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// -bind and -whitebind can't be set when not listening
|
|
|
|
// -bind and -whitebind can't be set when not listening
|
|
|
|
size_t nUserBind = |
|
|
|
size_t nUserBind = gArgs.GetArgs("-bind").size() + gArgs.GetArgs("-whitebind").size(); |
|
|
|
(gArgs.IsArgSet("-bind") ? gArgs.GetArgs("-bind").size() : 0) + |
|
|
|
|
|
|
|
(gArgs.IsArgSet("-whitebind") ? gArgs.GetArgs("-whitebind").size() : 0); |
|
|
|
|
|
|
|
if (nUserBind != 0 && !gArgs.GetBoolArg("-listen", DEFAULT_LISTEN)) { |
|
|
|
if (nUserBind != 0 && !gArgs.GetBoolArg("-listen", DEFAULT_LISTEN)) { |
|
|
|
return InitError("Cannot set -bind or -whitebind together with -listen=0"); |
|
|
|
return InitError("Cannot set -bind or -whitebind together with -listen=0"); |
|
|
|
} |
|
|
|
} |
|
|
@ -920,7 +918,6 @@ bool AppInitParameterInteraction() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Now remove the logging categories which were explicitly excluded
|
|
|
|
// Now remove the logging categories which were explicitly excluded
|
|
|
|
if (gArgs.IsArgSet("-debugexclude")) { |
|
|
|
|
|
|
|
for (const std::string& cat : gArgs.GetArgs("-debugexclude")) { |
|
|
|
for (const std::string& cat : gArgs.GetArgs("-debugexclude")) { |
|
|
|
uint32_t flag = 0; |
|
|
|
uint32_t flag = 0; |
|
|
|
if (!GetLogCategory(&flag, &cat)) { |
|
|
|
if (!GetLogCategory(&flag, &cat)) { |
|
|
@ -929,7 +926,6 @@ bool AppInitParameterInteraction() |
|
|
|
} |
|
|
|
} |
|
|
|
logCategories &= ~flag; |
|
|
|
logCategories &= ~flag; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check for -debugnet
|
|
|
|
// Check for -debugnet
|
|
|
|
if (GetBoolArg("-debugnet", false)) |
|
|
|
if (GetBoolArg("-debugnet", false)) |
|
|
@ -1238,14 +1234,11 @@ 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<std::string> uacomments; |
|
|
|
std::vector<std::string> uacomments; |
|
|
|
if (gArgs.IsArgSet("-uacomment")) { |
|
|
|
for (const std::string& cmt : gArgs.GetArgs("-uacomment")) { |
|
|
|
for (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(_("User Agent comment (%s) contains unsafe characters."), cmt)); |
|
|
|
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt)); |
|
|
|
uacomments.push_back(cmt); |
|
|
|
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) { |
|
|
|
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments."), |
|
|
|
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments."), |
|
|
@ -1317,7 +1310,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
fDiscover = GetBoolArg("-discover", true); |
|
|
|
fDiscover = GetBoolArg("-discover", true); |
|
|
|
fRelayTxes = !GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY); |
|
|
|
fRelayTxes = !GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY); |
|
|
|
|
|
|
|
|
|
|
|
if (gArgs.IsArgSet("-externalip")) { |
|
|
|
|
|
|
|
for (const std::string& strAddr : gArgs.GetArgs("-externalip")) { |
|
|
|
for (const std::string& strAddr : gArgs.GetArgs("-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()) |
|
|
@ -1325,7 +1317,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
else |
|
|
|
else |
|
|
|
return InitError(ResolveErrMsg("externalip", strAddr)); |
|
|
|
return InitError(ResolveErrMsg("externalip", strAddr)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLE_ZMQ |
|
|
|
#if ENABLE_ZMQ |
|
|
|
pzmqNotificationInterface = CZMQNotificationInterface::Create(); |
|
|
|
pzmqNotificationInterface = CZMQNotificationInterface::Create(); |
|
|
@ -1553,9 +1544,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback); |
|
|
|
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback); |
|
|
|
|
|
|
|
|
|
|
|
std::vector<fs::path> vImportFiles; |
|
|
|
std::vector<fs::path> vImportFiles; |
|
|
|
if (gArgs.IsArgSet("-loadblock")) |
|
|
|
for (const std::string& strFile : gArgs.GetArgs("-loadblock")) { |
|
|
|
{ |
|
|
|
|
|
|
|
for (const std::string& strFile : gArgs.GetArgs("-loadblock")) |
|
|
|
|
|
|
|
vImportFiles.push_back(strFile); |
|
|
|
vImportFiles.push_back(strFile); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1598,7 +1587,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
connOptions.nMaxOutboundTimeframe = nMaxOutboundTimeframe; |
|
|
|
connOptions.nMaxOutboundTimeframe = nMaxOutboundTimeframe; |
|
|
|
connOptions.nMaxOutboundLimit = nMaxOutboundLimit; |
|
|
|
connOptions.nMaxOutboundLimit = nMaxOutboundLimit; |
|
|
|
|
|
|
|
|
|
|
|
if (gArgs.IsArgSet("-bind")) { |
|
|
|
|
|
|
|
for (const std::string& strBind : gArgs.GetArgs("-bind")) { |
|
|
|
for (const std::string& strBind : gArgs.GetArgs("-bind")) { |
|
|
|
CService addrBind; |
|
|
|
CService addrBind; |
|
|
|
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) { |
|
|
|
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) { |
|
|
@ -1606,8 +1594,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
} |
|
|
|
} |
|
|
|
connOptions.vBinds.push_back(addrBind); |
|
|
|
connOptions.vBinds.push_back(addrBind); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (gArgs.IsArgSet("-whitebind")) { |
|
|
|
|
|
|
|
for (const std::string& strBind : gArgs.GetArgs("-whitebind")) { |
|
|
|
for (const std::string& strBind : gArgs.GetArgs("-whitebind")) { |
|
|
|
CService addrBind; |
|
|
|
CService addrBind; |
|
|
|
if (!Lookup(strBind.c_str(), addrBind, 0, false)) { |
|
|
|
if (!Lookup(strBind.c_str(), addrBind, 0, false)) { |
|
|
@ -1618,9 +1604,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
} |
|
|
|
} |
|
|
|
connOptions.vWhiteBinds.push_back(addrBind); |
|
|
|
connOptions.vWhiteBinds.push_back(addrBind); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gArgs.IsArgSet("-whitelist")) { |
|
|
|
|
|
|
|
for (const auto& net : gArgs.GetArgs("-whitelist")) { |
|
|
|
for (const auto& net : gArgs.GetArgs("-whitelist")) { |
|
|
|
CSubNet subnet; |
|
|
|
CSubNet subnet; |
|
|
|
LookupSubNet(net.c_str(), subnet); |
|
|
|
LookupSubNet(net.c_str(), subnet); |
|
|
@ -1628,7 +1612,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) |
|
|
|
return InitError(strprintf(_("Invalid netmask specified in -whitelist: '%s'"), net)); |
|
|
|
return InitError(strprintf(_("Invalid netmask specified in -whitelist: '%s'"), net)); |
|
|
|
connOptions.vWhitelistedRange.push_back(subnet); |
|
|
|
connOptions.vWhitelistedRange.push_back(subnet); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gArgs.IsArgSet("-seednode")) { |
|
|
|
if (gArgs.IsArgSet("-seednode")) { |
|
|
|
connOptions.vSeedNodes = gArgs.GetArgs("-seednode"); |
|
|
|
connOptions.vSeedNodes = gArgs.GetArgs("-seednode"); |
|
|
|