From a23e2ec3fe5963aef12fd19554fb486689765112 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Fri, 28 Aug 2015 00:06:19 -0400 Subject: [PATCH] cli_wallet: Include block_id and signed_by in get_block API result #253 --- .../wallet/include/graphene/wallet/wallet.hpp | 14 +++++++++++++- libraries/wallet/wallet.cpp | 9 ++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index f8f90978..3ebfe0f1 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -213,6 +213,15 @@ struct approval_delta vector key_approvals_to_remove; }; +struct signed_block_with_info : public signed_block +{ + signed_block_with_info( const signed_block& block ); + signed_block_with_info( const signed_block_with_info& block ) = default; + + block_id_type block_id; + fc::ecc::public_key signing_key; +}; + namespace detail { class wallet_api_impl; } @@ -232,7 +241,7 @@ class wallet_api fc::ecc::private_key derive_private_key(const std::string& prefix_string, int sequence_number) const; variant info(); - optional get_block( uint32_t num ); + optional get_block( uint32_t num ); /** Returns the number of accounts registered on the blockchain * @returns the number of registered accounts */ @@ -1302,6 +1311,9 @@ FC_REFLECT( graphene::wallet::approval_delta, (key_approvals_to_remove) ) +FC_REFLECT_DERIVED( graphene::wallet::signed_block_with_info, (graphene::chain::signed_block), + (block_id)(signing_key) ) + FC_API( graphene::wallet::wallet_api, (help) (gethelp) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 44c0a7c7..c0231841 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2096,7 +2096,7 @@ bool wallet_api::copy_wallet_file(string destination_filename) return my->copy_wallet_file(destination_filename); } -optional wallet_api::get_block(uint32_t num) +optional wallet_api::get_block(uint32_t num) { return my->_remote_db->get_block(num); } @@ -3389,6 +3389,13 @@ vector wallet_api::blind_history( string key_or_account ) return result; } +signed_block_with_info::signed_block_with_info( const signed_block& block ) + : signed_block( block ) +{ + block_id = id(); + signing_key = signee(); +} + } } // graphene::wallet void fc::to_variant(const account_multi_index_type& accts, fc::variant& vo)