Adding API call: get_potential_signatures

This call allows wallets to filter the set of keys that may potentially
sign a transaction prior to calling get_required_signatures to get the
minimum subset.
This commit is contained in:
Daniel Larimer 2015-08-06 13:43:18 -04:00
parent 0295f10387
commit b6385e2117
3 changed files with 29 additions and 1 deletions

View file

@ -1129,6 +1129,26 @@ namespace graphene { namespace app {
[&]( account_id_type id ){ return &id(_db).owner; },
_db.get_global_properties().parameters.max_authority_depth );
}
set<public_key_type> database_api::get_potential_signatures( const signed_transaction& trx )const
{
set<public_key_type> result;
trx.get_required_signatures( _db.get_chain_id(),
flat_set<public_key_type>(),
[&]( account_id_type id ){
const auto& auth = &id(_db).active
for( const auto& k : auth.get_keys() )
result.insert(k)
return &auth; },
[&]( account_id_type id ){
const auto& auth = &id(_db).owner
for( const auto& k : auth.get_keys() )
result.insert(k)
return &auth; },
},
_db.get_global_properties().parameters.max_authority_depth );
return result;
}
bool database_api::verify_authority( const signed_transaction& trx )const
{

View file

@ -331,6 +331,13 @@ namespace graphene { namespace app {
*/
set<public_key_type> get_required_signatures( const signed_transaction& trx, const flat_set<public_key_type>& available_keys )const;
/**
* This method will return the set of all public keys that could possibly sign for a given transaction. This call can
* be used by wallets to filter their set of public keys to just the relevant subset prior to calling @ref get_required_signatures
* to get the minimum subset.
*/
set<public_key_type> get_potential_signatures( const signed_transaction& trx )const;
/**
* @return true of the @ref trx has all of the required signatures, otherwise throws an exception
*/
@ -562,6 +569,7 @@ FC_API(graphene::app::database_api,
(get_balance_objects)
(get_vested_balances)
(get_required_signatures)
(get_potential_signatures)
(verify_authority)
(get_blinded_balances)
(get_required_fees)

@ -1 +1 @@
Subproject commit 088dadd12481e75829b83c098f3bc36b7e296ca0
Subproject commit d11b48a015e0c339cc20f739ef1f8a5b3c57b913