From f5b4a57702f866b0ca6fc9281abef4516ac293ee Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Wed, 19 Jun 2019 13:53:03 -0400 Subject: [PATCH] Fix -clientname, which must be used at runtime, not compile-time --- src/alert.cpp | 2 +- src/init.cpp | 2 +- src/rpc/net.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/alert.cpp b/src/alert.cpp index 4d832da7c..99f6472e9 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -137,7 +137,7 @@ bool CAlert::AppliesTo(int nVersion, const std::string& strSubVerIn) const bool CAlert::AppliesToMe() const { - return AppliesTo(PROTOCOL_VERSION, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector())); + return AppliesTo(PROTOCOL_VERSION, FormatSubVersion(GetArg("-clientname","MagicBean"), CLIENT_VERSION, std::vector())); } bool CAlert::RelayTo(CNode* pnode) const diff --git a/src/init.cpp b/src/init.cpp index 4ba38749a..0d55e30b0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1349,7 +1349,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) return InitError(strprintf("User Agent comment (%s) contains unsafe characters.", cmt)); uacomments.push_back(SanitizeString(cmt, SAFE_CHARS_UA_COMMENT)); } - strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments); + strSubVersion = FormatSubVersion(GetArg("-clientname","MagicBean"), CLIENT_VERSION, uacomments); if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) { return InitError(strprintf("Total length of network version string %i exceeds maximum of %i characters. Reduce the number and/or size of uacomments.", strSubVersion.size(), MAX_SUBVERSION_LENGTH)); diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 56f221a37..f7d7c90cb 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -484,7 +484,7 @@ UniValue getdeprecationinfo(const UniValue& params, bool fHelp) UniValue obj(UniValue::VOBJ); obj.push_back(Pair("version", CLIENT_VERSION)); obj.push_back(Pair("subversion", - FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector()))); + FormatSubVersion(GetArg("-clientname","MagicBean"), CLIENT_VERSION, std::vector()))); obj.push_back(Pair("deprecationheight", DEPRECATION_HEIGHT)); return obj;