mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-03 17:30:25 +01:00
Implement BIP 14 : separate protocol version from client version
This commit is contained in:
14
src/util.cpp
14
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user