rpc: add version to get_info

This commit is contained in:
Jethro Grassie 2018-11-20 13:18:08 -05:00
parent 84dd674cd0
commit 517f25efd1
No known key found for this signature in database
GPG Key ID: DE8ED755616565BB
5 changed files with 11 additions and 1 deletions

View File

@ -112,6 +112,7 @@ target_link_libraries(rpc
common common
cryptonote_core cryptonote_core
cryptonote_protocol cryptonote_protocol
version
${Boost_REGEX_LIBRARY} ${Boost_REGEX_LIBRARY}
${Boost_THREAD_LIBRARY} ${Boost_THREAD_LIBRARY}
PRIVATE PRIVATE
@ -121,6 +122,7 @@ target_link_libraries(daemon_messages
LINK_PRIVATE LINK_PRIVATE
cryptonote_core cryptonote_core
cryptonote_protocol cryptonote_protocol
version
serialization serialization
${EXTRA_LIBRARIES}) ${EXTRA_LIBRARIES})
@ -129,6 +131,7 @@ target_link_libraries(daemon_rpc_server
rpc rpc
cryptonote_core cryptonote_core
cryptonote_protocol cryptonote_protocol
version
daemon_messages daemon_messages
serialization serialization
${Boost_CHRONO_LIBRARY} ${Boost_CHRONO_LIBRARY}

View File

@ -210,6 +210,7 @@ namespace cryptonote
} }
res.database_size = m_core.get_blockchain_storage().get_db().get_database_size(); res.database_size = m_core.get_blockchain_storage().get_db().get_database_size();
res.update_available = m_core.is_update_available(); res.update_available = m_core.is_update_available();
res.version = m_restricted ? "" : MONERO_VERSION;
return true; return true;
} }
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------
@ -1609,6 +1610,7 @@ namespace cryptonote
} }
res.database_size = m_core.get_blockchain_storage().get_db().get_database_size(); res.database_size = m_core.get_blockchain_storage().get_db().get_database_size();
res.update_available = m_core.is_update_available(); res.update_available = m_core.is_update_available();
res.version = m_restricted ? "" : MONERO_VERSION;
return true; return true;
} }
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------

View File

@ -50,7 +50,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 1 #define CORE_RPC_VERSION_MINOR 2
#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)
@ -892,6 +892,7 @@ namespace cryptonote
bool was_bootstrap_ever_used; bool was_bootstrap_ever_used;
uint64_t database_size; uint64_t database_size;
bool update_available; bool update_available;
std::string version;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status) KV_SERIALIZE(status)
@ -926,6 +927,7 @@ namespace cryptonote
KV_SERIALIZE(was_bootstrap_ever_used) KV_SERIALIZE(was_bootstrap_ever_used)
KV_SERIALIZE(database_size) KV_SERIALIZE(database_size)
KV_SERIALIZE(update_available) KV_SERIALIZE(update_available)
KV_SERIALIZE(version)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
}; };

View File

@ -34,6 +34,7 @@
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote_basic/blobdatatype.h" #include "cryptonote_basic/blobdatatype.h"
#include "ringct/rctSigs.h" #include "ringct/rctSigs.h"
#include "version.h"
namespace cryptonote namespace cryptonote
{ {
@ -437,6 +438,7 @@ namespace rpc
res.info.block_size_limit = res.info.block_weight_limit = m_core.get_blockchain_storage().get_current_cumulative_block_weight_limit(); res.info.block_size_limit = res.info.block_weight_limit = m_core.get_blockchain_storage().get_current_cumulative_block_weight_limit();
res.info.block_size_median = res.info.block_weight_median = m_core.get_blockchain_storage().get_current_cumulative_block_weight_median(); res.info.block_size_median = res.info.block_weight_median = m_core.get_blockchain_storage().get_current_cumulative_block_weight_median();
res.info.start_time = (uint64_t)m_core.get_start_time(); res.info.start_time = (uint64_t)m_core.get_start_time();
res.info.version = MONERO_VERSION;
res.status = Message::STATUS_OK; res.status = Message::STATUS_OK;
res.error_details = ""; res.error_details = "";

View File

@ -191,6 +191,7 @@ namespace rpc
uint64_t block_size_median; uint64_t block_size_median;
uint64_t block_weight_median; uint64_t block_weight_median;
uint64_t start_time; uint64_t start_time;
std::string version;
}; };
struct output_distribution struct output_distribution