adding API call to get potential address sigs: Fix #337
This commit is contained in:
parent
2afe62f8ab
commit
738abf03af
3 changed files with 41 additions and 0 deletions
|
|
@ -92,6 +92,7 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
|
||||||
std::string get_transaction_hex(const signed_transaction& trx)const;
|
std::string get_transaction_hex(const signed_transaction& trx)const;
|
||||||
set<public_key_type> get_required_signatures( const signed_transaction& trx, const flat_set<public_key_type>& available_keys )const;
|
set<public_key_type> get_required_signatures( const signed_transaction& trx, const flat_set<public_key_type>& available_keys )const;
|
||||||
set<public_key_type> get_potential_signatures( const signed_transaction& trx )const;
|
set<public_key_type> get_potential_signatures( const signed_transaction& trx )const;
|
||||||
|
set<address> get_potential_address_signatures( const signed_transaction& trx )const;
|
||||||
bool verify_authority( const signed_transaction& trx )const;
|
bool verify_authority( const signed_transaction& trx )const;
|
||||||
bool verify_account_authority( const string& name_or_id, const flat_set<public_key_type>& signers )const;
|
bool verify_account_authority( const string& name_or_id, const flat_set<public_key_type>& signers )const;
|
||||||
processed_transaction validate_transaction( const signed_transaction& trx )const;
|
processed_transaction validate_transaction( const signed_transaction& trx )const;
|
||||||
|
|
@ -1213,6 +1214,10 @@ set<public_key_type> database_api::get_potential_signatures( const signed_transa
|
||||||
{
|
{
|
||||||
return my->get_potential_signatures( trx );
|
return my->get_potential_signatures( trx );
|
||||||
}
|
}
|
||||||
|
set<address> database_api::get_potential_address_signatures( const signed_transaction& trx )const
|
||||||
|
{
|
||||||
|
return my->get_potential_address_signatures( trx );
|
||||||
|
}
|
||||||
|
|
||||||
set<public_key_type> database_api_impl::get_potential_signatures( const signed_transaction& trx )const
|
set<public_key_type> database_api_impl::get_potential_signatures( const signed_transaction& trx )const
|
||||||
{
|
{
|
||||||
|
|
@ -1242,6 +1247,31 @@ set<public_key_type> database_api_impl::get_potential_signatures( const signed_t
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set<address> database_api_impl::get_potential_address_signatures( const signed_transaction& trx )const
|
||||||
|
{
|
||||||
|
set<address> 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_addresses() )
|
||||||
|
result.insert(k);
|
||||||
|
return &auth;
|
||||||
|
},
|
||||||
|
[&]( account_id_type id )
|
||||||
|
{
|
||||||
|
const auto& auth = id(_db).owner;
|
||||||
|
for( const auto& k : auth.get_addresses() )
|
||||||
|
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
|
bool database_api::verify_authority( const signed_transaction& trx )const
|
||||||
{
|
{
|
||||||
return my->verify_authority( trx );
|
return my->verify_authority( trx );
|
||||||
|
|
|
||||||
|
|
@ -416,6 +416,7 @@ class database_api
|
||||||
* to get the minimum subset.
|
* to get the minimum subset.
|
||||||
*/
|
*/
|
||||||
set<public_key_type> get_potential_signatures( const signed_transaction& trx )const;
|
set<public_key_type> get_potential_signatures( const signed_transaction& trx )const;
|
||||||
|
set<address> get_potential_address_signatures( const signed_transaction& trx )const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true of the @ref trx has all of the required signatures, otherwise throws an exception
|
* @return true of the @ref trx has all of the required signatures, otherwise throws an exception
|
||||||
|
|
@ -536,6 +537,7 @@ FC_API(graphene::app::database_api,
|
||||||
(get_transaction_hex)
|
(get_transaction_hex)
|
||||||
(get_required_signatures)
|
(get_required_signatures)
|
||||||
(get_potential_signatures)
|
(get_potential_signatures)
|
||||||
|
(get_potential_address_signatures)
|
||||||
(verify_authority)
|
(verify_authority)
|
||||||
(verify_account_authority)
|
(verify_account_authority)
|
||||||
(validate_transaction)
|
(validate_transaction)
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,15 @@ namespace graphene { namespace chain {
|
||||||
result.push_back(k.first);
|
result.push_back(k.first);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
vector<address> get_addresses() const
|
||||||
|
{
|
||||||
|
vector<address> result;
|
||||||
|
result.reserve( address_auths.size() );
|
||||||
|
for( const auto& k : address_auths )
|
||||||
|
result.push_back(k.first);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
friend bool operator == ( const authority& a, const authority& b )
|
friend bool operator == ( const authority& a, const authority& b )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue