Allow querying witness_node version by API
This commit is contained in:
parent
9012e86bd1
commit
0a38927b0e
2 changed files with 40 additions and 0 deletions
|
|
@ -29,12 +29,15 @@
|
|||
#include <graphene/chain/pts_address.hpp>
|
||||
#include <graphene/chain/tournament_object.hpp>
|
||||
|
||||
#include <graphene/utilities/git_revision.hpp>
|
||||
|
||||
#include <fc/bloom_filter.hpp>
|
||||
|
||||
#include <fc/crypto/hex.hpp>
|
||||
#include <fc/rpc/api_connection.hpp>
|
||||
#include <fc/uint128.hpp>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/rational.hpp>
|
||||
|
|
@ -90,6 +93,7 @@ public:
|
|||
processed_transaction get_transaction(uint32_t block_num, uint32_t trx_in_block) const;
|
||||
|
||||
// Globals
|
||||
version_info get_version_info() const;
|
||||
chain_property_object get_chain_properties() const;
|
||||
global_property_object get_global_properties() const;
|
||||
fc::variant_object get_config() const;
|
||||
|
|
@ -563,6 +567,27 @@ processed_transaction database_api_impl::get_transaction(uint32_t block_num, uin
|
|||
// //
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
version_info database_api::get_version_info() const {
|
||||
return my->get_version_info();
|
||||
}
|
||||
|
||||
version_info database_api_impl::get_version_info() const {
|
||||
|
||||
std::string witness_version(graphene::utilities::git_revision_description);
|
||||
const size_t pos = witness_version.find('/');
|
||||
if (pos != std::string::npos && witness_version.size() > pos)
|
||||
witness_version = witness_version.substr(pos + 1);
|
||||
|
||||
version_info vi;
|
||||
vi.version = witness_version;
|
||||
vi.git_revision = graphene::utilities::git_revision_sha;
|
||||
vi.built = std::string(__DATE__) + " at " + std::string(__TIME__);
|
||||
vi.openssl = OPENSSL_VERSION_TEXT;
|
||||
vi.boost = boost::replace_all_copy(std::string(BOOST_LIB_VERSION), "_", ".");
|
||||
|
||||
return vi;
|
||||
}
|
||||
|
||||
chain_property_object database_api::get_chain_properties() const {
|
||||
return my->get_chain_properties();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,14 @@ struct gpos_info {
|
|||
share_type account_vested_balance;
|
||||
};
|
||||
|
||||
struct version_info {
|
||||
string version;
|
||||
string git_revision;
|
||||
string built;
|
||||
string openssl;
|
||||
string boost;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The database_api class implements the RPC API for the chain database.
|
||||
*
|
||||
|
|
@ -218,6 +226,11 @@ public:
|
|||
// Globals //
|
||||
/////////////
|
||||
|
||||
/**
|
||||
* @brief Retrieve the @ref version_info associated with the witness node
|
||||
*/
|
||||
version_info get_version_info() const;
|
||||
|
||||
/**
|
||||
* @brief Retrieve the @ref chain_property_object associated with the chain
|
||||
*/
|
||||
|
|
@ -1040,6 +1053,7 @@ FC_REFLECT(graphene::app::market_ticker, (base)(quote)(latest)(lowest_ask)(highe
|
|||
FC_REFLECT(graphene::app::market_volume, (base)(quote)(base_volume)(quote_volume));
|
||||
FC_REFLECT(graphene::app::market_trade, (date)(price)(amount)(value));
|
||||
FC_REFLECT(graphene::app::gpos_info, (vesting_factor)(award)(total_amount)(current_subperiod)(last_voted_time)(allowed_withdraw_amount)(account_vested_balance));
|
||||
FC_REFLECT(graphene::app::version_info, (version)(git_revision)(built)(openssl)(boost));
|
||||
|
||||
FC_API(graphene::app::database_api,
|
||||
// Objects
|
||||
|
|
@ -1060,6 +1074,7 @@ FC_API(graphene::app::database_api,
|
|||
(get_recent_transaction_by_id)
|
||||
|
||||
// Globals
|
||||
(get_version_info)
|
||||
(get_chain_properties)
|
||||
(get_global_properties)
|
||||
(get_config)
|
||||
|
|
|
|||
Loading…
Reference in a new issue