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:
parent
cdfa2e58df
commit
33e91e1a1e
|
@ -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.")
|
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(VERSIONTAG "unknown")
|
||||||
|
set(VERSION_IS_RELEASE "false")
|
||||||
configure_file("src/version.cpp.in" "${TO}")
|
configure_file("src/version.cpp.in" "${TO}")
|
||||||
else()
|
else()
|
||||||
string(SUBSTRING ${COMMIT} 0 9 COMMIT)
|
string(SUBSTRING ${COMMIT} 0 9 COMMIT)
|
||||||
|
@ -47,6 +48,7 @@ else()
|
||||||
if(NOT TAGGEDCOMMIT)
|
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.")
|
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(VERSIONTAG "${COMMIT}")
|
||||||
|
set(VERSION_IS_RELEASE "false")
|
||||||
else()
|
else()
|
||||||
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
|
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
|
||||||
|
|
||||||
|
@ -54,9 +56,11 @@ else()
|
||||||
if(COMMIT STREQUAL TAGGEDCOMMIT)
|
if(COMMIT STREQUAL TAGGEDCOMMIT)
|
||||||
message(STATUS "You are building a tagged release")
|
message(STATUS "You are building a tagged release")
|
||||||
set(VERSIONTAG "release")
|
set(VERSIONTAG "release")
|
||||||
|
set(VERSION_IS_RELEASE "true")
|
||||||
else()
|
else()
|
||||||
message(STATUS "You are ahead of or behind a tagged release")
|
message(STATUS "You are ahead of or behind a tagged release")
|
||||||
set(VERSIONTAG "${COMMIT}")
|
set(VERSIONTAG "${COMMIT}")
|
||||||
|
set(VERSION_IS_RELEASE "false")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -2147,6 +2147,7 @@ namespace cryptonote
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
res.version = CORE_RPC_VERSION;
|
res.version = CORE_RPC_VERSION;
|
||||||
|
res.release = MONERO_VERSION_IS_RELEASE;
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace cryptonote
|
||||||
// advance which version they will stop working with
|
// advance which version they will stop working with
|
||||||
// Don't go over 32767 for any of these
|
// Don't go over 32767 for any of these
|
||||||
#define CORE_RPC_VERSION_MAJOR 2
|
#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 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)
|
#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;
|
std::string status;
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
|
bool release;
|
||||||
bool untrusted;
|
bool untrusted;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(status)
|
KV_SERIALIZE(status)
|
||||||
KV_SERIALIZE(version)
|
KV_SERIALIZE(version)
|
||||||
|
KV_SERIALIZE(release)
|
||||||
KV_SERIALIZE(untrusted)
|
KV_SERIALIZE(untrusted)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define DEF_MONERO_VERSION "0.14.1.2"
|
#define DEF_MONERO_VERSION "0.14.1.2"
|
||||||
#define DEF_MONERO_RELEASE_NAME "Boron Butterfly"
|
#define DEF_MONERO_RELEASE_NAME "Boron Butterfly"
|
||||||
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
||||||
|
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@
|
||||||
|
|
||||||
#include "version.h"
|
#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_VERSION = DEF_MONERO_VERSION;
|
||||||
const char* const MONERO_RELEASE_NAME = DEF_MONERO_RELEASE_NAME;
|
const char* const MONERO_RELEASE_NAME = DEF_MONERO_RELEASE_NAME;
|
||||||
const char* const MONERO_VERSION_FULL = DEF_MONERO_VERSION_FULL;
|
const char* const MONERO_VERSION_FULL = DEF_MONERO_VERSION_FULL;
|
||||||
|
const bool MONERO_VERSION_IS_RELEASE = DEF_MONERO_VERSION_IS_RELEASE;
|
||||||
|
|
|
@ -4,3 +4,4 @@ extern const char* const MONERO_VERSION_TAG;
|
||||||
extern const char* const MONERO_VERSION;
|
extern const char* const MONERO_VERSION;
|
||||||
extern const char* const MONERO_RELEASE_NAME;
|
extern const char* const MONERO_RELEASE_NAME;
|
||||||
extern const char* const MONERO_VERSION_FULL;
|
extern const char* const MONERO_VERSION_FULL;
|
||||||
|
extern const bool MONERO_VERSION_IS_RELEASE;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "include_base_utils.h"
|
#include "include_base_utils.h"
|
||||||
using namespace epee;
|
using namespace epee;
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
#include "wallet_rpc_server.h"
|
#include "wallet_rpc_server.h"
|
||||||
#include "wallet/wallet_args.h"
|
#include "wallet/wallet_args.h"
|
||||||
#include "common/command_line.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)
|
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.version = WALLET_RPC_VERSION;
|
||||||
|
res.release = MONERO_VERSION_IS_RELEASE;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
// advance which version they will stop working with
|
// advance which version they will stop working with
|
||||||
// Don't go over 32767 for any of these
|
// Don't go over 32767 for any of these
|
||||||
#define WALLET_RPC_VERSION_MAJOR 1
|
#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 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)
|
#define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR)
|
||||||
namespace tools
|
namespace tools
|
||||||
|
@ -2418,9 +2418,11 @@ namespace wallet_rpc
|
||||||
struct response_t
|
struct response_t
|
||||||
{
|
{
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
|
bool release;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(version)
|
KV_SERIALIZE(version)
|
||||||
|
KV_SERIALIZE(release)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
typedef epee::misc_utils::struct_init<response_t> response;
|
typedef epee::misc_utils::struct_init<response_t> response;
|
||||||
|
|
Loading…
Reference in New Issue