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("-uaclientname=<clientname>", "Set user agent client name", | |||||
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | |||||
argsman.AddArg("-uaclientversion=<clientversion>", | |||||
"Set user agent client 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,253 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); | ||||
} | } | ||||
const std::string client_name = args.GetArg("-uaclientname", CLIENT_NAME); | |||||
const std::string client_version = | |||||
args.GetArg("-uaclientversion", FormatVersion(CLIENT_VERSION)); | |||||
if (client_name != SanitizeString(client_name, SAFE_CHARS_UA_COMMENT)) { | |||||
return InitError(strprintf( | |||||
_("-uaclientname (%s) contains invalid characters."), client_name)); | |||||
} | |||||
if (client_version != | |||||
SanitizeString(client_version, SAFE_CHARS_UA_COMMENT)) { | |||||
return InitError( | |||||
strprintf(_("-uaclientversion (%s) contains invalid characters."), | |||||
client_version)); | |||||
} | |||||
const std::string strSubVersion = | const std::string strSubVersion = | ||||
FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments); | FormatUserAgent(client_name, client_version, 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 |