adding new API calls that can be used to check required signatures on transactions
This commit is contained in:
parent
6bdc0f69b6
commit
c77cb49cc2
2 changed files with 30 additions and 0 deletions
|
|
@ -812,5 +812,20 @@ namespace graphene { namespace app {
|
|||
return result;
|
||||
} FC_CAPTURE_AND_RETHROW( (addrs) ) }
|
||||
|
||||
set<public_key_type> database_api::get_required_signatures( const signed_transaction& trx, const flat_set<public_key_type>& available_keys )const
|
||||
{
|
||||
return trx.get_required_signatures( available_keys,
|
||||
[&]( account_id_type id ){ return &id(_db).active; },
|
||||
[&]( account_id_type id ){ return &id(_db).owner; },
|
||||
_db.get_global_properties().parameters.max_authority_depth );
|
||||
}
|
||||
|
||||
bool database_api::verify_authority( const signed_transaction& trx )const
|
||||
{
|
||||
trx.verify_authority( [&]( account_id_type id ){ return &id(_db).active; },
|
||||
[&]( account_id_type id ){ return &id(_db).owner; },
|
||||
_db.get_global_properties().parameters.max_authority_depth );
|
||||
return true;
|
||||
}
|
||||
|
||||
} } // graphene::app
|
||||
|
|
|
|||
|
|
@ -302,6 +302,19 @@ namespace graphene { namespace app {
|
|||
/** @return all unclaimed balance objects for a set of addresses */
|
||||
vector<balance_object> get_balance_objects( const vector<address>& addrs )const;
|
||||
|
||||
|
||||
/**
|
||||
* This API will take a partially signed transaction and a set of public keys that the owner has the ability to sign for
|
||||
* and return the minimal subset of public keys that should add signatures to the transaction.
|
||||
*/
|
||||
set<public_key_type> get_required_signatures( const signed_transaction& trx, const flat_set<public_key_type>& available_keys )const;
|
||||
|
||||
/**
|
||||
* @return true of the @ref trx has all of the required signatures, otherwise throws an exception
|
||||
*/
|
||||
bool verify_authority( const signed_transaction& trx )const;
|
||||
|
||||
|
||||
private:
|
||||
/** called every time a block is applied to report the objects that were changed */
|
||||
void on_objects_changed(const vector<object_id_type>& ids);
|
||||
|
|
@ -506,6 +519,8 @@ FC_API(graphene::app::database_api,
|
|||
(get_key_references)
|
||||
(get_margin_positions)
|
||||
(get_balance_objects)
|
||||
(get_required_signatures)
|
||||
(verify_authority)
|
||||
)
|
||||
FC_API(graphene::app::history_api,
|
||||
(get_account_history)
|
||||
|
|
|
|||
Loading…
Reference in a new issue