Implement BIP 14 : separate protocol version from client version

This commit is contained in:
Gavin Andresen
2011-12-16 16:26:14 -05:00
parent 8896c2d9d6
commit f8ded588a2
12 changed files with 96 additions and 70 deletions

View File

@@ -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();
}