cli_wallet: Include block_id and signed_by in get_block API result #253

This commit is contained in:
theoreticalbts 2015-08-28 00:06:19 -04:00
parent 823adbbed5
commit a23e2ec3fe
2 changed files with 21 additions and 2 deletions

View file

@ -213,6 +213,15 @@ struct approval_delta
vector<string> 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<signed_block> get_block( uint32_t num );
optional<signed_block_with_info> 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)

View file

@ -2096,7 +2096,7 @@ bool wallet_api::copy_wallet_file(string destination_filename)
return my->copy_wallet_file(destination_filename);
}
optional<signed_block> wallet_api::get_block(uint32_t num)
optional<signed_block_with_info> wallet_api::get_block(uint32_t num)
{
return my->_remote_db->get_block(num);
}
@ -3389,6 +3389,13 @@ vector<blind_receipt> 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)