From 14589ef2e747924f1fa36dae024d242d3045260b Mon Sep 17 00:00:00 2001 From: Dcorral Date: Mon, 25 Apr 2022 09:53:29 +0200 Subject: [PATCH 1/8] Add version suffix to getversioninfo --- src/clientversion.cpp | 12 ++++++++++++ src/clientversion.h | 1 + src/rpc/net.cpp | 24 ++++++++++++------------ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index fb4f8d8811..b69bda17e7 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -54,9 +54,13 @@ const std::string CLIENT_NAME("DeFiChain"); #define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) +#define BUILD_CLIENT_SUFFIX(suffix) \ + DO_STRINGIZE(suffix) #define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit +#define BUILD_CLIENT_SUFFIX_FROM_COMMIT(commit) \ + "-g" commit #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" @@ -64,14 +68,17 @@ const std::string CLIENT_NAME("DeFiChain"); #ifndef BUILD_DESC #ifdef BUILD_SUFFIX #define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX) +#define BUILD_CLIENT_SUFX BUILD_CLIENT_SUFFIX(BUILD_SUFFIX) #elif defined(GIT_COMMIT_ID) #define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID) +#define BUILD_CLIENT_SUFX BUILD_CLIENT_SUFFIX_FROM_COMMIT(GIT_COMMIT_ID) #else #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) #endif #endif const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX); +const std::string SUFFIX_BUILD(BUILD_CLIENT_SUFX); std::string FormatVersion(int nVersion) { @@ -86,6 +93,11 @@ std::string FormatVersionAndSuffix() return CLIENT_BUILD; } +std::string FormatSuffix() +{ + return SUFFIX_BUILD; +} + /** * Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki) */ diff --git a/src/clientversion.h b/src/clientversion.h index ebc296b911..ee2f89303b 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -46,6 +46,7 @@ extern const std::string CLIENT_BUILD; std::string FormatVersion(int nVersion); std::string FormatVersionAndSuffix(); +std::string FormatSuffix(); std::string FormatUserAgentString(const std::string& name, int nClientVersion, const std::vector& comments); #endif // WINDRES_PREPROC diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 0889e6d161..c9c1fb4e4b 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -518,15 +518,16 @@ static UniValue getversioninfo(const JSONRPCRequest& request){ {}, RPCResult{ "{\n" - " \"name\": DeFiChain (string) Node name\n" - " \"version\": \"xxxxx\", (string) Node version string\n" - " \"numericVersion\": xxxxx, (number) Node numeric version\n" - " \"fullVersion\": \"DefiChain:x.x.x\", (string) Full node version string including name and version\n" - " \"userAgent\": \"/DefiChain:x.x.x/\", (string) P2P user agent string (subversion string conforming to BIP-14)\n" - " \"protoVersion\": \"xxxxx\", (number) Operating protocol version\n" - " \"protoVersionMin\": \"xxxxx\", (number) Minimum protocol that's supported by the node\n" - " \"rpcVersion\": \"xxxxx\", (string) RPC version\n" - " \"rpcVersionMin\": \"xxxxx\", (string) Minimum RPC version supported\n" + " \"name\": DeFiChain (string) Node name\n" + " \"version\": \"xxxxx\", (string) Node version string\n" + " \"numericVersion\": xxxxx, (number) Node numeric version\n" + " \"fullVersion\": \"DefiChain:x.x.x-suffix\", (string) Full node version string including name and full version including suffix\n" + " \"versionSuffix\": \"xxxxx\", (string) Version suffix\n" + " \"userAgent\": \"/DefiChain:x.x.x/\", (string) P2P user agent string (subversion string conforming to BIP-14)\n" + " \"protoVersion\": \"xxxxx\", (number) Operating protocol version\n" + " \"protoVersionMin\": \"xxxxx\", (number) Minimum protocol that's supported by the node\n" + " \"rpcVersion\": \"xxxxx\", (string) RPC version\n" + " \"rpcVersionMin\": \"xxxxx\", (string) Minimum RPC version supported\n" " \"spv\":\n" " \"{\n" " \"btc\":\n" @@ -546,8 +547,6 @@ static UniValue getversioninfo(const JSONRPCRequest& request){ UniValue nodeInfoObj(UniValue::VOBJ); - - UniValue btcInfoObj(UniValue::VOBJ); btcInfoObj.pushKV("version", BR_PROTOCOL_VERSION); btcInfoObj.pushKV("min", BR_MIN_PROTO_VERSION); @@ -557,12 +556,13 @@ static UniValue getversioninfo(const JSONRPCRequest& request){ spvInfoObj.pushKV("btc", btcInfoObj); std::ostringstream strFullVersion; - strFullVersion << CLIENT_NAME << ":" << FormatVersion(CLIENT_VERSION); + strFullVersion << CLIENT_NAME << ":" << FormatVersionAndSuffix(); nodeInfoObj.pushKV("name", CLIENT_NAME); nodeInfoObj.pushKV("version", FormatVersion(CLIENT_VERSION)); nodeInfoObj.pushKV("numericVersion", CLIENT_VERSION); nodeInfoObj.pushKV("fullVersion",strFullVersion.str()); + nodeInfoObj.pushKV("versionSuffix", FormatSuffix()); nodeInfoObj.pushKV("userAgent",strSubVersion); nodeInfoObj.pushKV("protoVersion",PROTOCOL_VERSION); nodeInfoObj.pushKV("protoVersionMin",MIN_PEER_PROTO_VERSION); From 61af507e5fd3f97a94d0c3b6e38ea941e492b42a Mon Sep 17 00:00:00 2001 From: Dcorral Date: Wed, 27 Apr 2022 11:37:16 +0200 Subject: [PATCH 2/8] Parse suffix at rpc level --- src/clientversion.cpp | 14 -------------- src/clientversion.h | 1 - src/rpc/net.cpp | 4 +++- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index b69bda17e7..722d23c7e2 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -54,31 +54,22 @@ const std::string CLIENT_NAME("DeFiChain"); #define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) -#define BUILD_CLIENT_SUFFIX(suffix) \ - DO_STRINGIZE(suffix) - #define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit -#define BUILD_CLIENT_SUFFIX_FROM_COMMIT(commit) \ - "-g" commit - #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" #ifndef BUILD_DESC #ifdef BUILD_SUFFIX #define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX) -#define BUILD_CLIENT_SUFX BUILD_CLIENT_SUFFIX(BUILD_SUFFIX) #elif defined(GIT_COMMIT_ID) #define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID) -#define BUILD_CLIENT_SUFX BUILD_CLIENT_SUFFIX_FROM_COMMIT(GIT_COMMIT_ID) #else #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) #endif #endif const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX); -const std::string SUFFIX_BUILD(BUILD_CLIENT_SUFX); std::string FormatVersion(int nVersion) { @@ -93,11 +84,6 @@ std::string FormatVersionAndSuffix() return CLIENT_BUILD; } -std::string FormatSuffix() -{ - return SUFFIX_BUILD; -} - /** * Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki) */ diff --git a/src/clientversion.h b/src/clientversion.h index ee2f89303b..ebc296b911 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -46,7 +46,6 @@ extern const std::string CLIENT_BUILD; std::string FormatVersion(int nVersion); std::string FormatVersionAndSuffix(); -std::string FormatSuffix(); std::string FormatUserAgentString(const std::string& name, int nClientVersion, const std::vector& comments); #endif // WINDRES_PREPROC diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index c9c1fb4e4b..cf98c5ed2d 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -562,7 +562,9 @@ static UniValue getversioninfo(const JSONRPCRequest& request){ nodeInfoObj.pushKV("version", FormatVersion(CLIENT_VERSION)); nodeInfoObj.pushKV("numericVersion", CLIENT_VERSION); nodeInfoObj.pushKV("fullVersion",strFullVersion.str()); - nodeInfoObj.pushKV("versionSuffix", FormatSuffix()); + auto stringFullVersion = strFullVersion.str(); + auto suffix = stringFullVersion.substr(stringFullVersion.find('-')+1, std::string::npos); + nodeInfoObj.pushKV("versionSuffix", suffix); nodeInfoObj.pushKV("userAgent",strSubVersion); nodeInfoObj.pushKV("protoVersion",PROTOCOL_VERSION); nodeInfoObj.pushKV("protoVersionMin",MIN_PEER_PROTO_VERSION); From 0f4cdb1059c7db6cd31ccd0864ca85742ae95ebc Mon Sep 17 00:00:00 2001 From: Dcorral Date: Wed, 27 Apr 2022 11:56:49 +0200 Subject: [PATCH 3/8] Add define for suffix and FormatVersionSuffix() --- src/clientversion.cpp | 11 +++++++---- src/clientversion.h | 1 + src/rpc/net.cpp | 4 +--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 722d23c7e2..70baa70d7a 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -54,16 +54,14 @@ const std::string CLIENT_NAME("DeFiChain"); #define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) -#define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \ - "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" +#define BUILD_ONLY_SUFFIX(suffix) \ + DO_STRINGIZE(suffix) #ifndef BUILD_DESC #ifdef BUILD_SUFFIX #define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX) -#elif defined(GIT_COMMIT_ID) -#define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID) #else #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) #endif @@ -84,6 +82,11 @@ std::string FormatVersionAndSuffix() return CLIENT_BUILD; } +std::string FormatVersionSuffix() +{ + return BUILD_ONLY_SUFFIX(BUILD_SUFFIX); +} + /** * Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki) */ diff --git a/src/clientversion.h b/src/clientversion.h index ebc296b911..bda46d8a17 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -46,6 +46,7 @@ extern const std::string CLIENT_BUILD; std::string FormatVersion(int nVersion); std::string FormatVersionAndSuffix(); +std::string FormatVersionSuffix(); std::string FormatUserAgentString(const std::string& name, int nClientVersion, const std::vector& comments); #endif // WINDRES_PREPROC diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index cf98c5ed2d..0e69fc7b69 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -562,9 +562,7 @@ static UniValue getversioninfo(const JSONRPCRequest& request){ nodeInfoObj.pushKV("version", FormatVersion(CLIENT_VERSION)); nodeInfoObj.pushKV("numericVersion", CLIENT_VERSION); nodeInfoObj.pushKV("fullVersion",strFullVersion.str()); - auto stringFullVersion = strFullVersion.str(); - auto suffix = stringFullVersion.substr(stringFullVersion.find('-')+1, std::string::npos); - nodeInfoObj.pushKV("versionSuffix", suffix); + nodeInfoObj.pushKV("versionSuffix", FormatVersionSuffix()); nodeInfoObj.pushKV("userAgent",strSubVersion); nodeInfoObj.pushKV("protoVersion",PROTOCOL_VERSION); nodeInfoObj.pushKV("protoVersionMin",MIN_PEER_PROTO_VERSION); From 92f8cb0d05b992c512a15515ec3d34a03bb66d22 Mon Sep 17 00:00:00 2001 From: Dcorral Date: Wed, 27 Apr 2022 12:18:09 +0200 Subject: [PATCH 4/8] Remove GIT_ARCHIVE related and build suffix from unknown --- src/clientversion.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 70baa70d7a..9c714e5a2c 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -46,28 +46,27 @@ const std::string CLIENT_NAME("DeFiChain"); #define BUILD_SUFFIX release #endif -//! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$ -#ifdef GIT_ARCHIVE -#define GIT_COMMIT_ID "$Format:%H$" -#define GIT_COMMIT_DATE "$Format:%cD$" -#endif - #define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" #define BUILD_ONLY_SUFFIX(suffix) \ DO_STRINGIZE(suffix) +#define BUILD_ONLY_SUFFIX_FROM_UNKNOWN() \ + "-unk" #ifndef BUILD_DESC #ifdef BUILD_SUFFIX #define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX) +#define BUILD_DESC_SUFFIX BUILD_ONLY_SUFFIX(BUILD_SUFFIX) #else #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) +#define BUILD_DESC_SUFFIX BUILD_ONLY_SUFFIX() #endif #endif const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX); +const std::string CLIENT_BUILD_SUFFIX(BUILD_DESC_SUFFIX CLIENT_VERSION_SUFFIX); std::string FormatVersion(int nVersion) { @@ -84,7 +83,7 @@ std::string FormatVersionAndSuffix() std::string FormatVersionSuffix() { - return BUILD_ONLY_SUFFIX(BUILD_SUFFIX); + return CLIENT_BUILD_SUFFIX; } /** From 0e29b04e6a263c98f4cd1c89768ceaee3c843a9c Mon Sep 17 00:00:00 2001 From: Dcorral Date: Wed, 27 Apr 2022 12:23:08 +0200 Subject: [PATCH 5/8] Fix BUILD_DESC_WITH_SUFFIX --- src/clientversion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 9c714e5a2c..95be82a6d5 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -61,7 +61,7 @@ const std::string CLIENT_NAME("DeFiChain"); #define BUILD_DESC_SUFFIX BUILD_ONLY_SUFFIX(BUILD_SUFFIX) #else #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) -#define BUILD_DESC_SUFFIX BUILD_ONLY_SUFFIX() +#define BUILD_DESC_SUFFIX BUILD_ONLY_SUFFIX_FROM_UNKNOWN() #endif #endif From 5c7d8352ea09bcf01efd24ff3287e300f0efa80e Mon Sep 17 00:00:00 2001 From: Dcorral Date: Wed, 27 Apr 2022 13:01:00 +0200 Subject: [PATCH 6/8] Fix suggestions --- src/clientversion.cpp | 4 ++-- src/rpc/net.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 95be82a6d5..21e629bd4f 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -49,11 +49,11 @@ const std::string CLIENT_NAME("DeFiChain"); #define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \ - "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" + "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unknown" #define BUILD_ONLY_SUFFIX(suffix) \ DO_STRINGIZE(suffix) #define BUILD_ONLY_SUFFIX_FROM_UNKNOWN() \ - "-unk" + "unknown" #ifndef BUILD_DESC #ifdef BUILD_SUFFIX diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 0e69fc7b69..347632d0dc 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -520,9 +520,9 @@ static UniValue getversioninfo(const JSONRPCRequest& request){ "{\n" " \"name\": DeFiChain (string) Node name\n" " \"version\": \"xxxxx\", (string) Node version string\n" + " \"versionSuffix\": \"xxxxx\", (string) Version suffix\n" " \"numericVersion\": xxxxx, (number) Node numeric version\n" " \"fullVersion\": \"DefiChain:x.x.x-suffix\", (string) Full node version string including name and full version including suffix\n" - " \"versionSuffix\": \"xxxxx\", (string) Version suffix\n" " \"userAgent\": \"/DefiChain:x.x.x/\", (string) P2P user agent string (subversion string conforming to BIP-14)\n" " \"protoVersion\": \"xxxxx\", (number) Operating protocol version\n" " \"protoVersionMin\": \"xxxxx\", (number) Minimum protocol that's supported by the node\n" @@ -560,9 +560,9 @@ static UniValue getversioninfo(const JSONRPCRequest& request){ nodeInfoObj.pushKV("name", CLIENT_NAME); nodeInfoObj.pushKV("version", FormatVersion(CLIENT_VERSION)); + nodeInfoObj.pushKV("versionSuffix", FormatVersionSuffix()); nodeInfoObj.pushKV("numericVersion", CLIENT_VERSION); nodeInfoObj.pushKV("fullVersion",strFullVersion.str()); - nodeInfoObj.pushKV("versionSuffix", FormatVersionSuffix()); nodeInfoObj.pushKV("userAgent",strSubVersion); nodeInfoObj.pushKV("protoVersion",PROTOCOL_VERSION); nodeInfoObj.pushKV("protoVersionMin",MIN_PEER_PROTO_VERSION); From 2268afbdeb548338ac689276fadf0f49e6152a94 Mon Sep 17 00:00:00 2001 From: Dcorral Date: Wed, 27 Apr 2022 18:32:26 +0200 Subject: [PATCH 7/8] Change naming --- src/clientversion.cpp | 10 +++++----- src/clientversion.h | 2 +- src/rpc/net.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 21e629bd4f..5b012343be 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -50,18 +50,18 @@ const std::string CLIENT_NAME("DeFiChain"); "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unknown" -#define BUILD_ONLY_SUFFIX(suffix) \ +#define BUILD_SUFFIX_TAIL(suffix) \ DO_STRINGIZE(suffix) -#define BUILD_ONLY_SUFFIX_FROM_UNKNOWN() \ +#define BUILD_SUFFIX_TAIL_FROM_UNKNOWN() \ "unknown" #ifndef BUILD_DESC #ifdef BUILD_SUFFIX #define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX) -#define BUILD_DESC_SUFFIX BUILD_ONLY_SUFFIX(BUILD_SUFFIX) +#define BUILD_DESC_SUFFIX BUILD_SUFFIX_TAIL(BUILD_SUFFIX) #else #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) -#define BUILD_DESC_SUFFIX BUILD_ONLY_SUFFIX_FROM_UNKNOWN() +#define BUILD_DESC_SUFFIX BUILD_SUFFIX_TAIL_FROM_UNKNOWN() #endif #endif @@ -81,7 +81,7 @@ std::string FormatVersionAndSuffix() return CLIENT_BUILD; } -std::string FormatVersionSuffix() +std::string FormatVersionSuffixTail() { return CLIENT_BUILD_SUFFIX; } diff --git a/src/clientversion.h b/src/clientversion.h index bda46d8a17..504aeac4dd 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -46,7 +46,7 @@ extern const std::string CLIENT_BUILD; std::string FormatVersion(int nVersion); std::string FormatVersionAndSuffix(); -std::string FormatVersionSuffix(); +std::string FormatVersionSuffixTail(); std::string FormatUserAgentString(const std::string& name, int nClientVersion, const std::vector& comments); #endif // WINDRES_PREPROC diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 347632d0dc..73d6e365f1 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -560,7 +560,7 @@ static UniValue getversioninfo(const JSONRPCRequest& request){ nodeInfoObj.pushKV("name", CLIENT_NAME); nodeInfoObj.pushKV("version", FormatVersion(CLIENT_VERSION)); - nodeInfoObj.pushKV("versionSuffix", FormatVersionSuffix()); + nodeInfoObj.pushKV("versionSuffix", FormatVersionSuffixTail()); nodeInfoObj.pushKV("numericVersion", CLIENT_VERSION); nodeInfoObj.pushKV("fullVersion",strFullVersion.str()); nodeInfoObj.pushKV("userAgent",strSubVersion); From 42497d68b5d9876597775dcbed55ac4dfdd1dc9b Mon Sep 17 00:00:00 2001 From: Dcorral Date: Fri, 29 Apr 2022 07:32:07 +0200 Subject: [PATCH 8/8] Remove outdated comments and unnecessary code --- src/clientversion.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 5b012343be..9d2d539dc4 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -27,13 +27,9 @@ const std::string CLIENT_NAME("DeFiChain"); * * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is * generated by the build environment, possibly containing the output * of git-describe in a macro called BUILD_DESC - * * secondly, if this is an exported version of the code, GIT_ARCHIVE will - * be defined (automatically using the export-subst git attribute), and - * GIT_COMMIT will contain the commit id. - * * then, three options exist for determining CLIENT_BUILD: + * * then, two options exist for determining CLIENT_BUILD: * * if BUILD_DESC is defined, use that literally (output of git-describe) - * * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit] - * * otherwise, use v[maj].[min].[rev].[build]-unk + * * otherwise, use v[maj].[min].[rev].[build]-unknown * finally CLIENT_VERSION_SUFFIX is added */ @@ -52,8 +48,6 @@ const std::string CLIENT_NAME("DeFiChain"); "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unknown" #define BUILD_SUFFIX_TAIL(suffix) \ DO_STRINGIZE(suffix) -#define BUILD_SUFFIX_TAIL_FROM_UNKNOWN() \ - "unknown" #ifndef BUILD_DESC #ifdef BUILD_SUFFIX @@ -61,7 +55,7 @@ const std::string CLIENT_NAME("DeFiChain"); #define BUILD_DESC_SUFFIX BUILD_SUFFIX_TAIL(BUILD_SUFFIX) #else #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) -#define BUILD_DESC_SUFFIX BUILD_SUFFIX_TAIL_FROM_UNKNOWN() +#define BUILD_DESC_SUFFIX "unknown" #endif #endif