Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,024 Lines • ▼ Show 20 Lines | #endif | ||||
argsman.AddArg( | argsman.AddArg( | ||||
"-shrinkdebugfile", | "-shrinkdebugfile", | ||||
"Shrink debug.log file on client startup (default: 1 when no -debug)", | "Shrink debug.log file on client startup (default: 1 when no -debug)", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | ||||
argsman.AddArg("-uacomment=<cmt>", | argsman.AddArg("-uacomment=<cmt>", | ||||
"Append comment to the user agent string", | "Append comment to the user agent string", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | ||||
argsman.AddArg("-uaclient=<ua>", | |||||
"Set user agent client name and version in the form of " | |||||
"ClientName:Version", | |||||
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | |||||
SetupChainParamsBaseOptions(argsman); | SetupChainParamsBaseOptions(argsman); | ||||
argsman.AddArg( | argsman.AddArg( | ||||
"-acceptnonstdtxn", | "-acceptnonstdtxn", | ||||
strprintf( | strprintf( | ||||
"Relay and mine \"non-standard\" transactions (%sdefault: %u)", | "Relay and mine \"non-standard\" transactions (%sdefault: %u)", | ||||
"testnet/regtest only; ", defaultChainParams->RequireStandard()), | "testnet/regtest only; ", defaultChainParams->RequireStandard()), | ||||
▲ Show 20 Lines • Show All 1,246 Lines • ▼ Show 20 Lines | #endif | ||||
std::vector<std::string> uacomments; | std::vector<std::string> uacomments; | ||||
for (const std::string &cmt : args.GetArgs("-uacomment")) { | for (const std::string &cmt : args.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)); | ||||
} | } | ||||
uacomments.push_back(cmt); | uacomments.push_back(cmt); | ||||
} | } | ||||
std::string uaclient; | |||||
if (args.IsArgSet("-uaclient")) { | |||||
uaclient = args.GetArg("-uaclient", ""); | |||||
size_t colonpos = uaclient.find(':'); | |||||
if (std::string::npos == colonpos) { | |||||
return InitError(strprintf( | |||||
_("-uaclient (%s) must be of form ClientName:Version."), | |||||
uaclient)); | |||||
} | |||||
deadalnix: It doesn't looks like this should be enforced. | |||||
const std::string name = uaclient.substr(0, colonpos); | |||||
const std::string version = | |||||
uaclient.substr(colonpos + 1, uaclient.size() - colonpos - 1); | |||||
if (name != SanitizeString(name, SAFE_CHARS_UA_COMMENT)) { | |||||
return InitError(strprintf( | |||||
_("-uaclient client name (%s) contains invalid characters."), | |||||
name)); | |||||
} | |||||
if (version != SanitizeString(version, SAFE_CHARS_UA_COMMENT)) { | |||||
return InitError(strprintf(_("-uaclient client version (%s) " | |||||
"contains invalid characters."), | |||||
version)); | |||||
} | |||||
} else { | |||||
uaclient = FormatUserAgent(CLIENT_NAME, CLIENT_VERSION); | |||||
} | |||||
const std::string strSubVersion = | const std::string strSubVersion = | ||||
FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments); | FormatSubVersionUserAgent(uaclient, uacomments); | ||||
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) { | if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) { | ||||
return InitError(strprintf( | return InitError(strprintf( | ||||
_("Total length of network version string (%i) exceeds maximum " | _("Total length of network version string (%i) exceeds maximum " | ||||
"length (%i). Reduce the number or size of uacomments."), | "length (%i). Reduce the number or size of uacomments."), | ||||
strSubVersion.size(), MAX_SUBVERSION_LENGTH)); | strSubVersion.size(), MAX_SUBVERSION_LENGTH)); | ||||
} | } | ||||
if (args.IsArgSet("-onlynet")) { | if (args.IsArgSet("-onlynet")) { | ||||
▲ Show 20 Lines • Show All 675 Lines • Show Last 20 Lines |
It doesn't looks like this should be enforced.