optimize operation results for void ops

This commit is contained in:
Daniel Larimer 2015-06-09 16:49:42 -04:00
parent 00078afa07
commit df14ef5fef
4 changed files with 21 additions and 21 deletions

View file

@ -22,7 +22,7 @@
namespace graphene { namespace chain { namespace graphene { namespace chain {
object_id_type account_create_evaluator::do_evaluate( const account_create_operation& op ) void_result account_create_evaluator::do_evaluate( const account_create_operation& op )
{ try { { try {
FC_ASSERT( db().find_object(op.voting_account) ); FC_ASSERT( db().find_object(op.voting_account) );
FC_ASSERT( is_relative(op.memo_key) || db().find_object(op.memo_key) ); FC_ASSERT( is_relative(op.memo_key) || db().find_object(op.memo_key) );
@ -97,7 +97,7 @@ object_id_type account_create_evaluator::do_evaluate( const account_create_opera
FC_ASSERT( op.owner.auths.find( parent_account_itr->id ) != op.owner.auths.end() ); FC_ASSERT( op.owner.auths.find( parent_account_itr->id ) != op.owner.auths.end() );
} }
return object_id_type(); return void_result();
} FC_CAPTURE_AND_RETHROW( (op) ) } } FC_CAPTURE_AND_RETHROW( (op) ) }
object_id_type account_create_evaluator::do_apply( const account_create_operation& o ) object_id_type account_create_evaluator::do_apply( const account_create_operation& o )
@ -136,7 +136,7 @@ object_id_type account_create_evaluator::do_apply( const account_create_operatio
} FC_CAPTURE_AND_RETHROW((o)) } } FC_CAPTURE_AND_RETHROW((o)) }
object_id_type account_update_evaluator::do_evaluate( const account_update_operation& o ) void_result account_update_evaluator::do_evaluate( const account_update_operation& o )
{ {
database& d = db(); database& d = db();
@ -174,9 +174,9 @@ object_id_type account_update_evaluator::do_evaluate( const account_update_opera
} }
} }
return object_id_type(); return void_result();
} }
object_id_type account_update_evaluator::do_apply( const account_update_operation& o ) void_result account_update_evaluator::do_apply( const account_update_operation& o )
{ {
db().modify( *acnt, [&]( account_object& a ){ db().modify( *acnt, [&]( account_object& a ){
if( o.owner ) a.owner = *o.owner; if( o.owner ) a.owner = *o.owner;
@ -192,10 +192,10 @@ object_id_type account_update_evaluator::do_apply( const account_update_operatio
a.num_witness = o.num_witness; a.num_witness = o.num_witness;
a.num_committee = o.num_committee; a.num_committee = o.num_committee;
}); });
return object_id_type(); return void_result();
} }
object_id_type account_whitelist_evaluator::do_evaluate(const account_whitelist_operation& o) void_result account_whitelist_evaluator::do_evaluate(const account_whitelist_operation& o)
{ try { { try {
database& d = db(); database& d = db();
@ -203,10 +203,10 @@ object_id_type account_whitelist_evaluator::do_evaluate(const account_whitelist_
if( !d.get_global_properties().parameters.allow_non_prime_whitelists ) if( !d.get_global_properties().parameters.allow_non_prime_whitelists )
FC_ASSERT(listed_account->is_prime()); FC_ASSERT(listed_account->is_prime());
return object_id_type(); return void_result();
} FC_CAPTURE_AND_RETHROW( (o) ) } } FC_CAPTURE_AND_RETHROW( (o) ) }
object_id_type account_whitelist_evaluator::do_apply(const account_whitelist_operation& o) void_result account_whitelist_evaluator::do_apply(const account_whitelist_operation& o)
{ {
database& d = db(); database& d = db();
@ -221,7 +221,7 @@ object_id_type account_whitelist_evaluator::do_apply(const account_whitelist_ope
a.blacklisting_accounts.erase(o.authorizing_account); a.blacklisting_accounts.erase(o.authorizing_account);
}); });
return object_id_type(); return void_result();
} }
} } // graphene::chain } } // graphene::chain

View file

@ -26,7 +26,7 @@ namespace graphene { namespace chain {
public: public:
typedef account_create_operation operation_type; typedef account_create_operation operation_type;
object_id_type do_evaluate( const account_create_operation& o ); void_result do_evaluate( const account_create_operation& o );
object_id_type do_apply( const account_create_operation& o ) ; object_id_type do_apply( const account_create_operation& o ) ;
}; };
@ -35,8 +35,8 @@ namespace graphene { namespace chain {
public: public:
typedef account_update_operation operation_type; typedef account_update_operation operation_type;
object_id_type do_evaluate( const account_update_operation& o ); void_result do_evaluate( const account_update_operation& o );
object_id_type do_apply( const account_update_operation& o ); void_result do_apply( const account_update_operation& o );
const account_object* acnt; const account_object* acnt;
}; };
@ -46,8 +46,8 @@ namespace graphene { namespace chain {
public: public:
typedef account_whitelist_operation operation_type; typedef account_whitelist_operation operation_type;
object_id_type do_evaluate( const account_whitelist_operation& o); void_result do_evaluate( const account_whitelist_operation& o);
object_id_type do_apply( const account_whitelist_operation& o); void_result do_apply( const account_whitelist_operation& o);
const account_object* listed_account; const account_object* listed_account;
}; };

View file

@ -27,8 +27,8 @@ namespace graphene { namespace chain {
public: public:
typedef transfer_operation operation_type; typedef transfer_operation operation_type;
object_id_type do_evaluate( const transfer_operation& o ); void_result do_evaluate( const transfer_operation& o );
object_id_type do_apply( const transfer_operation& o ); void_result do_apply( const transfer_operation& o );
}; };
} } // graphene::chain } } // graphene::chain

View file

@ -19,7 +19,7 @@
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
namespace graphene { namespace chain { namespace graphene { namespace chain {
object_id_type transfer_evaluator::do_evaluate( const transfer_operation& op ) void_result transfer_evaluator::do_evaluate( const transfer_operation& op )
{ try { { try {
database& d = db(); database& d = db();
@ -43,13 +43,13 @@ object_id_type transfer_evaluator::do_evaluate( const transfer_operation& op )
FC_ASSERT( d.get_balance( &from_account, &asset_type ).amount >= op.amount.amount, FC_ASSERT( d.get_balance( &from_account, &asset_type ).amount >= op.amount.amount,
"", ("total_transfer",op.amount)("balance",d.get_balance(&from_account, &asset_type).amount) ); "", ("total_transfer",op.amount)("balance",d.get_balance(&from_account, &asset_type).amount) );
return object_id_type(); return void_result();
} FC_CAPTURE_AND_RETHROW( (op) ) } } FC_CAPTURE_AND_RETHROW( (op) ) }
object_id_type transfer_evaluator::do_apply( const transfer_operation& o ) void_result transfer_evaluator::do_apply( const transfer_operation& o )
{ try { { try {
db().adjust_balance( o.from, -o.amount ); db().adjust_balance( o.from, -o.amount );
db().adjust_balance( o.to, o.amount ); db().adjust_balance( o.to, o.amount );
return object_id_type(); return void_result();
} FC_CAPTURE_AND_RETHROW( (o) )} } FC_CAPTURE_AND_RETHROW( (o) )}
} } // graphene::chain } } // graphene::chain