Skip to content

Commit

Permalink
Issue #210: Formatting and build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielhourt committed Jul 31, 2019
1 parent a081fff commit 48a5457
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 241 deletions.
74 changes: 37 additions & 37 deletions libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2268,71 +2268,71 @@ set<address> database_api::get_potential_address_signatures( const signed_transa
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
{
auto chain_time = _db.head_block_time();
bool allow_non_immediate_owner = (chain_time >= HARDFORK_CORE_584_TIME);
bool ignore_custom_op_reqd_auths = MUST_IGNORE_CUSTOM_OP_REQD_AUTHS(chain_time);
bool allow_non_immediate_owner = ( chain_time >= HARDFORK_CORE_584_TIME );
bool ignore_custom_op_reqd_auths = MUST_IGNORE_CUSTOM_OP_REQD_AUTHS( chain_time );

set<public_key_type> result;
auto get_active = [this, &result](account_id_type id) {
const auto& auth = id(_db).active;
for (const auto& k : auth.get_keys())
result.insert(k);
auto get_active = [this, &result]( account_id_type id ){
const auto& auth = id( _db ).active;
for( const auto& k : auth.get_keys() )
result.insert( k );
return &auth;
};
auto get_owner = [this, &result](account_id_type id) {
const auto& auth = id(_db).owner;
for (const auto& k : auth.get_keys())
result.insert(k);
auto get_owner = [this, &result]( account_id_type id ){
const auto& auth = id( _db ).owner;
for( const auto& k : auth.get_keys() )
result.insert( k );
return &auth;
};

trx.get_required_signatures(_db.get_chain_id(),
flat_set<public_key_type>(),
get_active, get_owner,
allow_non_immediate_owner,
ignore_custom_op_reqd_auths,
_db.get_global_properties().parameters.max_authority_depth);
trx.get_required_signatures( _db.get_chain_id(),
flat_set<public_key_type>(),
get_active, get_owner,
allow_non_immediate_owner,
ignore_custom_op_reqd_auths,
_db.get_global_properties().parameters.max_authority_depth );

// Insert keys in required "other" authories
flat_set<account_id_type> required_active;
flat_set<account_id_type> required_owner;
vector<authority> other;
trx.get_required_authorities(required_active, required_owner, other, ignore_custom_op_reqd_auths);
for (const auto& auth : other)
for (const auto& key : auth.get_keys())
result.insert(key);
trx.get_required_authorities( required_active, required_owner, other, ignore_custom_op_reqd_auths );
for( const auto& auth : other )
for( const auto& key : auth.get_keys() )
result.insert( key );

return result;
}

set<address> database_api_impl::get_potential_address_signatures(const signed_transaction& trx)const
set<address> database_api_impl::get_potential_address_signatures( const signed_transaction& trx )const
{
auto chain_time = _db.head_block_time();
bool allow_non_immediate_owner = (chain_time >= HARDFORK_CORE_584_TIME);
bool ignore_custom_op_reqd_auths = MUST_IGNORE_CUSTOM_OP_REQD_AUTHS(chain_time);
bool allow_non_immediate_owner = ( chain_time >= HARDFORK_CORE_584_TIME );
bool ignore_custom_op_reqd_auths = MUST_IGNORE_CUSTOM_OP_REQD_AUTHS( chain_time );

set<address> result;
auto get_active = [this, &result](account_id_type id) {
const auto& auth = id(_db).active;
for (const auto& k : auth.get_addresses())
result.insert(k);
auto get_active = [this, &result]( account_id_type id ){
const auto& auth = id( _db ).active;
for( const auto& k : auth.get_addresses() )
result.insert( k );
return &auth;
};
auto get_owner = [this, &result](account_id_type id) {
const auto& auth = id(_db).owner;
auto get_owner = [this, &result]( account_id_type id ) {
const auto& auth = id( _db ).owner;
for (const auto& k : auth.get_addresses())
result.insert(k);
result.insert( k );
return &auth;
};

trx.get_required_signatures(_db.get_chain_id(),
flat_set<public_key_type>(),
get_active, get_owner,
allow_non_immediate_owner,
ignore_custom_op_reqd_auths,
_db.get_global_properties().parameters.max_authority_depth);
trx.get_required_signatures( _db.get_chain_id(),
flat_set<public_key_type>(),
get_active, get_owner,
allow_non_immediate_owner,
ignore_custom_op_reqd_auths,
_db.get_global_properties().parameters.max_authority_depth );
return result;
}

Expand Down
46 changes: 23 additions & 23 deletions libraries/chain/db_notify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ struct get_impacted_account_visitor
flat_set<account_id_type>& _impacted;
bool _ignore_custom_op_reqd_auths;

get_impacted_account_visitor(flat_set<account_id_type>& impact, bool ignore_custom_operation_required_auths)
: _impacted(impact), _ignore_custom_op_reqd_auths(ignore_custom_operation_required_auths)
get_impacted_account_visitor( flat_set<account_id_type>& impact, bool ignore_custom_operation_required_auths )
: _impacted( impact ), _ignore_custom_op_reqd_auths( ignore_custom_operation_required_auths )
{}

using result_type = void;
Expand Down Expand Up @@ -158,10 +158,10 @@ struct get_impacted_account_visitor
{
_impacted.insert( op.fee_payer() ); // fee_paying_account
vector<authority> other;
for (const auto& proposed_op : op.proposed_ops)
operation_get_required_authorities(proposed_op.op, _impacted, _impacted, other, _ignore_custom_op_reqd_auths);
for (auto& o : other)
add_authority_accounts(_impacted, o);
for( const auto& proposed_op : op.proposed_ops )
operation_get_required_authorities( proposed_op.op, _impacted, _impacted, other, _ignore_custom_op_reqd_auths );
for( auto& o : other )
add_authority_accounts( _impacted, o );
}
void operator()( const proposal_update_operation& op )
{
Expand Down Expand Up @@ -218,9 +218,9 @@ struct get_impacted_account_visitor
}
void operator()( const custom_operation& op )
{
_impacted.insert(op.fee_payer()); // payer
if (!_ignore_custom_op_reqd_auths)
_impacted.insert(op.required_auths.begin(), op.required_auths.end());
_impacted.insert( op.fee_payer() ); // payer
if( !_ignore_custom_op_reqd_auths )
_impacted.insert( op.required_auths.begin(), op.required_auths.end() );
}
void operator()( const assert_operation& op )
{
Expand Down Expand Up @@ -290,17 +290,17 @@ struct get_impacted_account_visitor
}
};

void graphene::chain::operation_get_impacted_accounts(const operation& op, flat_set<account_id_type>& result, bool ignore_custom_operation_required_auths) {
get_impacted_account_visitor vtor = get_impacted_account_visitor(result, ignore_custom_operation_required_auths);
op.visit(vtor);
void graphene::chain::operation_get_impacted_accounts( const operation& op, flat_set<account_id_type>& result, bool ignore_custom_operation_required_auths ) {
get_impacted_account_visitor vtor = get_impacted_account_visitor( result, ignore_custom_operation_required_auths );
op.visit( vtor );
}

void graphene::chain::transaction_get_impacted_accounts(const transaction& tx, flat_set<account_id_type>& result, bool ignore_custom_operation_required_auths) {
for (const auto& op : tx.operations)
operation_get_impacted_accounts(op, result, ignore_custom_operation_required_auths);
void graphene::chain::transaction_get_impacted_accounts( const transaction& tx, flat_set<account_id_type>& result, bool ignore_custom_operation_required_auths ) {
for( const auto& op : tx.operations )
operation_get_impacted_accounts( op, result, ignore_custom_operation_required_auths );
}

void get_relevant_accounts(const object* obj, flat_set<account_id_type>& accounts, bool ignore_custom_operation_required_auths) {
void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accounts, bool ignore_custom_operation_required_auths ) {
if( obj->id.space() == protocol_ids )
{
switch( (object_type)obj->id.type() )
Expand Down Expand Up @@ -346,14 +346,14 @@ void get_relevant_accounts(const object* obj, flat_set<account_id_type>& account
} case proposal_object_type:{
const auto& aobj = dynamic_cast<const proposal_object*>(obj);
FC_ASSERT( aobj != nullptr );
transaction_get_impacted_accounts(aobj->proposed_transaction, accounts,
ignore_custom_operation_required_auths);
transaction_get_impacted_accounts( aobj->proposed_transaction, accounts,
ignore_custom_operation_required_auths );
break;
} case operation_history_object_type:{
const auto& aobj = dynamic_cast<const operation_history_object*>(obj);
FC_ASSERT( aobj != nullptr );
operation_get_impacted_accounts(aobj->op, accounts,
ignore_custom_operation_required_auths);
operation_get_impacted_accounts( aobj->op, accounts,
ignore_custom_operation_required_auths );
break;
} case withdraw_permission_object_type:{
const auto& aobj = dynamic_cast<const withdraw_permission_object*>(obj);
Expand Down Expand Up @@ -410,8 +410,8 @@ void get_relevant_accounts(const object* obj, flat_set<account_id_type>& account
} case impl_transaction_history_object_type:{
const auto& aobj = dynamic_cast<const transaction_history_object*>(obj);
FC_ASSERT( aobj != nullptr );
transaction_get_impacted_accounts(aobj->trx, accounts,
ignore_custom_operation_required_auths);
transaction_get_impacted_accounts( aobj->trx, accounts,
ignore_custom_operation_required_auths );
break;
} case impl_blinded_balance_object_type:{
const auto& aobj = dynamic_cast<const blinded_balance_object*>(obj);
Expand Down Expand Up @@ -517,7 +517,7 @@ void database::notify_changed_objects()
}

if( removed_ids.size() )
GRAPHENE_TRY_NOTIFY(removed_objects, removed_ids, removed, removed_accounts_impacted)
GRAPHENE_TRY_NOTIFY( removed_objects, removed_ids, removed, removed_accounts_impacted )
}
}
} FC_CAPTURE_AND_LOG( (0) ) }
Expand Down
12 changes: 6 additions & 6 deletions libraries/chain/include/graphene/chain/impacted.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@

namespace graphene { namespace chain {

void operation_get_impacted_accounts(const graphene::chain::operation& op,
fc::flat_set<graphene::chain::account_id_type>& result,
bool ignore_custom_operation_required_auths);
void operation_get_impacted_accounts( const graphene::chain::operation& op,
fc::flat_set<graphene::chain::account_id_type>& result,
bool ignore_custom_operation_required_auths );

void transaction_get_impacted_accounts(const graphene::chain::transaction& tx,
fc::flat_set<graphene::chain::account_id_type>& result,
bool ignore_custom_operation_required_auths);
void transaction_get_impacted_accounts( const graphene::chain::transaction& tx,
fc::flat_set<graphene::chain::account_id_type>& result,
bool ignore_custom_operation_required_auths );

} } // graphene::app
Loading

0 comments on commit 48a5457

Please sign in to comment.