aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-12-16 16:26:14 -0500
committerGavin Andresen <gavinandresen@gmail.com>2011-12-19 10:24:23 -0500
commitf8ded588a2f78ac2767a60c716a7d15c273b4fc7 (patch)
treef8bb01303f5feb0bf04a8fb01ada04b58304a207 /src/util.cpp
parent8896c2d9d64d71e25b31d7a389f0b8db49a1e50a (diff)
downloadbitcoin-f8ded588a2f78ac2767a60c716a7d15c273b4fc7.tar.xz
Implement BIP 14 : separate protocol version from client version
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 236c7f7c44..ef276e5103 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -4,6 +4,7 @@
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "headers.h"
#include "strlcpy.h"
+#include <boost/algorithm/string/join.hpp>
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/filesystem.hpp>
@@ -1001,7 +1002,7 @@ string FormatVersion(int nVersion)
string FormatFullVersion()
{
- string s = FormatVersion(VERSION) + pszSubVer;
+ string s = FormatVersion(CLIENT_VERSION);
if (VERSION_IS_BETA) {
s += "-";
s += _("beta");
@@ -1009,6 +1010,17 @@ string FormatFullVersion()
return s;
}
+// Format the subversion field according to BIP 14 spec (https://en.bitcoin.it/wiki/BIP_0014)
+std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
+{
+ std::ostringstream ss;
+ ss << "/";
+ ss << name << ":" << FormatVersion(nClientVersion);
+ if (!comments.empty())
+ ss << "(" << boost::algorithm::join(comments, "; ") << ")";
+ ss << "/";
+ return ss.str();
+}