wallet, rpc: add a release field to get_version

It does not leak much since you can make a fair guess by RPC
version already, and some people want to avoid non release
clients when using third parties' nodes (because they'd never
lie about it)
This commit is contained in:
moneromooo-monero 2019-05-17 09:04:38 +00:00
parent cdfa2e58df
commit 33e91e1a1e
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
7 changed files with 16 additions and 2 deletions

View File

@ -36,6 +36,7 @@ if(RET)
message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
set(VERSIONTAG "unknown")
set(VERSION_IS_RELEASE "false")
configure_file("src/version.cpp.in" "${TO}")
else()
string(SUBSTRING ${COMMIT} 0 9 COMMIT)
@ -47,6 +48,7 @@ else()
if(NOT TAGGEDCOMMIT)
message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
set(VERSIONTAG "${COMMIT}")
set(VERSION_IS_RELEASE "false")
else()
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
@ -54,9 +56,11 @@ else()
if(COMMIT STREQUAL TAGGEDCOMMIT)
message(STATUS "You are building a tagged release")
set(VERSIONTAG "release")
set(VERSION_IS_RELEASE "true")
else()
message(STATUS "You are ahead of or behind a tagged release")
set(VERSIONTAG "${COMMIT}")
set(VERSION_IS_RELEASE "false")
endif()
endif()

View File

@ -2147,6 +2147,7 @@ namespace cryptonote
return r;
res.version = CORE_RPC_VERSION;
res.release = MONERO_VERSION_IS_RELEASE;
res.status = CORE_RPC_STATUS_OK;
return true;
}

View File

@ -87,7 +87,7 @@ namespace cryptonote
// advance which version they will stop working with
// Don't go over 32767 for any of these
#define CORE_RPC_VERSION_MAJOR 2
#define CORE_RPC_VERSION_MINOR 9
#define CORE_RPC_VERSION_MINOR 10
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
@ -2053,11 +2053,13 @@ namespace cryptonote
{
std::string status;
uint32_t version;
bool release;
bool untrusted;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
KV_SERIALIZE(version)
KV_SERIALIZE(release)
KV_SERIALIZE(untrusted)
END_KV_SERIALIZE_MAP()
};

View File

@ -2,6 +2,7 @@
#define DEF_MONERO_VERSION "0.14.1.2"
#define DEF_MONERO_RELEASE_NAME "Boron Butterfly"
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@
#include "version.h"
@ -9,3 +10,4 @@ const char* const MONERO_VERSION_TAG = DEF_MONERO_VERSION_TAG;
const char* const MONERO_VERSION = DEF_MONERO_VERSION;
const char* const MONERO_RELEASE_NAME = DEF_MONERO_RELEASE_NAME;
const char* const MONERO_VERSION_FULL = DEF_MONERO_VERSION_FULL;
const bool MONERO_VERSION_IS_RELEASE = DEF_MONERO_VERSION_IS_RELEASE;

View File

@ -4,3 +4,4 @@ extern const char* const MONERO_VERSION_TAG;
extern const char* const MONERO_VERSION;
extern const char* const MONERO_RELEASE_NAME;
extern const char* const MONERO_VERSION_FULL;
extern const bool MONERO_VERSION_IS_RELEASE;

View File

@ -36,6 +36,7 @@
#include "include_base_utils.h"
using namespace epee;
#include "version.h"
#include "wallet_rpc_server.h"
#include "wallet/wallet_args.h"
#include "common/command_line.h"
@ -4188,6 +4189,7 @@ namespace tools
bool wallet_rpc_server::on_get_version(const wallet_rpc::COMMAND_RPC_GET_VERSION::request& req, wallet_rpc::COMMAND_RPC_GET_VERSION::response& res, epee::json_rpc::error& er, const connection_context *ctx)
{
res.version = WALLET_RPC_VERSION;
res.release = MONERO_VERSION_IS_RELEASE;
return true;
}
//------------------------------------------------------------------------------------------------------------------------------

View File

@ -47,7 +47,7 @@
// advance which version they will stop working with
// Don't go over 32767 for any of these
#define WALLET_RPC_VERSION_MAJOR 1
#define WALLET_RPC_VERSION_MINOR 13
#define WALLET_RPC_VERSION_MINOR 14
#define MAKE_WALLET_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR)
namespace tools
@ -2418,9 +2418,11 @@ namespace wallet_rpc
struct response_t
{
uint32_t version;
bool release;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(version)
KV_SERIALIZE(release)
END_KV_SERIALIZE_MAP()
};
typedef epee::misc_utils::struct_init<response_t> response;