convert more operations to void_result

This commit is contained in:
Daniel Larimer 2015-06-15 15:24:58 -04:00
parent 4490c3fa48
commit 9b920c798a
12 changed files with 46 additions and 46 deletions

View file

@ -67,21 +67,21 @@ object_id_type bond_create_offer_evaluator::do_apply( const bond_create_offer_op
} }
object_id_type bond_cancel_offer_evaluator::do_evaluate( const bond_cancel_offer_operation& op ) void_result bond_cancel_offer_evaluator::do_evaluate( const bond_cancel_offer_operation& op )
{ {
_offer = &op.offer_id(db()); _offer = &op.offer_id(db());
FC_ASSERT( op.creator == _offer->offered_by_account ); FC_ASSERT( op.creator == _offer->offered_by_account );
FC_ASSERT( _offer->amount == op.refund ); FC_ASSERT( _offer->amount == op.refund );
return object_id_type(); return void_result();
} }
object_id_type bond_cancel_offer_evaluator::do_apply( const bond_cancel_offer_operation& op ) void_result bond_cancel_offer_evaluator::do_apply( const bond_cancel_offer_operation& op )
{ {
assert( _offer != nullptr ); assert( _offer != nullptr );
db().adjust_balance( op.creator, op.refund ); db().adjust_balance( op.creator, op.refund );
db().adjust_core_in_orders( op.creator(db()), -op.refund ); db().adjust_core_in_orders( op.creator(db()), -op.refund );
db().remove( *_offer ); db().remove( *_offer );
return object_id_type(); return void_result();
} }
object_id_type bond_accept_offer_evaluator::do_evaluate( const bond_accept_offer_operation& op ) object_id_type bond_accept_offer_evaluator::do_evaluate( const bond_accept_offer_operation& op )
@ -148,7 +148,7 @@ object_id_type bond_accept_offer_evaluator::do_apply( const bond_accept_offer_op
object_id_type bond_claim_collateral_evaluator::do_evaluate( const bond_claim_collateral_operation& op ) void_result bond_claim_collateral_evaluator::do_evaluate( const bond_claim_collateral_operation& op )
{ {
_bond = &op.bond_id(db()); _bond = &op.bond_id(db());
auto head_time = db().get_dynamic_global_properties().time; auto head_time = db().get_dynamic_global_properties().time;
@ -185,10 +185,10 @@ object_id_type bond_claim_collateral_evaluator::do_evaluate( const bond_claim_co
FC_ASSERT( _bond->collateral == op.collateral_claimed ); FC_ASSERT( _bond->collateral == op.collateral_claimed );
FC_ASSERT( op.payoff_amount == asset(0,_bond->borrowed.asset_id ) ); FC_ASSERT( op.payoff_amount == asset(0,_bond->borrowed.asset_id ) );
} }
return object_id_type(); return void_result();
} }
object_id_type bond_claim_collateral_evaluator::do_apply( const bond_claim_collateral_operation& op ) void_result bond_claim_collateral_evaluator::do_apply( const bond_claim_collateral_operation& op )
{ {
assert( _bond != nullptr ); assert( _bond != nullptr );
@ -212,7 +212,7 @@ object_id_type bond_claim_collateral_evaluator::do_apply( const bond_claim_colla
bond.start_date = db().get_dynamic_global_properties().time; bond.start_date = db().get_dynamic_global_properties().time;
}); });
return object_id_type(); return void_result();
} }
} } // graphene::chain } } // graphene::chain

View file

@ -21,20 +21,20 @@
namespace graphene { namespace chain { namespace graphene { namespace chain {
object_id_type global_parameters_update_evaluator::do_evaluate(const global_parameters_update_operation& o) void_result global_parameters_update_evaluator::do_evaluate(const global_parameters_update_operation& o)
{ {
FC_ASSERT(trx_state->_is_proposed_trx); FC_ASSERT(trx_state->_is_proposed_trx);
return object_id_type(); return void_result();
} }
object_id_type global_parameters_update_evaluator::do_apply(const global_parameters_update_operation& o) void_result global_parameters_update_evaluator::do_apply(const global_parameters_update_operation& o)
{ {
db().modify(db().get_global_properties(), [&o](global_property_object& p) { db().modify(db().get_global_properties(), [&o](global_property_object& p) {
p.pending_parameters = o.new_parameters; p.pending_parameters = o.new_parameters;
}); });
return object_id_type(); return void_result();
} }
} } // graphene::chain } } // graphene::chain

View file

@ -35,8 +35,8 @@ class bond_cancel_offer_evaluator : public evaluator<bond_cancel_offer_evaluator
public: public:
typedef bond_cancel_offer_operation operation_type; typedef bond_cancel_offer_operation operation_type;
object_id_type do_evaluate( const bond_cancel_offer_operation& op ); void_result do_evaluate( const bond_cancel_offer_operation& op );
object_id_type do_apply( const bond_cancel_offer_operation& op ); void_result do_apply( const bond_cancel_offer_operation& op );
const bond_offer_object* _offer = nullptr; const bond_offer_object* _offer = nullptr;
}; };
@ -58,8 +58,8 @@ class bond_claim_collateral_evaluator : public evaluator<bond_claim_collateral_e
public: public:
typedef bond_claim_collateral_operation operation_type; typedef bond_claim_collateral_operation operation_type;
object_id_type do_evaluate( const bond_claim_collateral_operation& op ); void_result do_evaluate( const bond_claim_collateral_operation& op );
object_id_type do_apply( const bond_claim_collateral_operation& op ); void_result do_apply( const bond_claim_collateral_operation& op );
const bond_object* _bond = nullptr; const bond_object* _bond = nullptr;
asset _interest_due; asset _interest_due;

View file

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

View file

@ -26,8 +26,8 @@ class global_parameters_update_evaluator : public evaluator<global_parameters_up
public: public:
typedef global_parameters_update_operation operation_type; typedef global_parameters_update_operation operation_type;
object_id_type do_evaluate( const global_parameters_update_operation& o ); void_result do_evaluate( const global_parameters_update_operation& o );
object_id_type do_apply( const global_parameters_update_operation& o ); void_result do_apply( const global_parameters_update_operation& o );
}; };
} } // graphene::chain } } // graphene::chain

View file

@ -40,8 +40,8 @@ namespace graphene { namespace chain {
public: public:
typedef proposal_update_operation operation_type; typedef proposal_update_operation operation_type;
object_id_type do_evaluate( const proposal_update_operation& o ); void_result do_evaluate( const proposal_update_operation& o );
object_id_type do_apply( const proposal_update_operation& o ); void_result do_apply( const proposal_update_operation& o );
const proposal_object* _proposal = nullptr; const proposal_object* _proposal = nullptr;
processed_transaction _processed_transaction; processed_transaction _processed_transaction;
@ -54,8 +54,8 @@ namespace graphene { namespace chain {
public: public:
typedef proposal_delete_operation operation_type; typedef proposal_delete_operation operation_type;
object_id_type do_evaluate( const proposal_delete_operation& o ); void_result do_evaluate( const proposal_delete_operation& o );
object_id_type do_apply(const proposal_delete_operation&); void_result do_apply(const proposal_delete_operation&);
const proposal_object* _proposal = nullptr; const proposal_object* _proposal = nullptr;
}; };

View file

@ -38,8 +38,8 @@ class vesting_balance_withdraw_evaluator : public evaluator<vesting_balance_with
public: public:
typedef vesting_balance_withdraw_operation operation_type; typedef vesting_balance_withdraw_operation operation_type;
object_id_type do_evaluate( const vesting_balance_withdraw_operation& op ); void_result do_evaluate( const vesting_balance_withdraw_operation& op );
object_id_type do_apply( const vesting_balance_withdraw_operation& op ); void_result do_apply( const vesting_balance_withdraw_operation& op );
}; };
} } // graphene::chain } } // graphene::chain

View file

@ -35,8 +35,8 @@ namespace graphene { namespace chain {
public: public:
typedef witness_withdraw_pay_operation operation_type; typedef witness_withdraw_pay_operation operation_type;
object_id_type do_evaluate( const operation_type& o ); void_result do_evaluate( const operation_type& o );
object_id_type do_apply( const operation_type& o ); void_result do_apply( const operation_type& o );
const witness_object* witness; const witness_object* witness;
const account_object* to_account; const account_object* to_account;

View file

@ -73,7 +73,7 @@ object_id_type proposal_create_evaluator::do_apply(const proposal_create_operati
return proposal.id; return proposal.id;
} }
object_id_type proposal_update_evaluator::do_evaluate(const proposal_update_operation& o) void_result proposal_update_evaluator::do_evaluate(const proposal_update_operation& o)
{ {
database& d = db(); database& d = db();
@ -102,10 +102,10 @@ object_id_type proposal_update_evaluator::do_evaluate(const proposal_update_oper
FC_ASSERT( trx_state->signed_by(id) || trx_state->_skip_authority_check ); FC_ASSERT( trx_state->signed_by(id) || trx_state->_skip_authority_check );
} }
return object_id_type(); return void_result();
} }
object_id_type proposal_update_evaluator::do_apply(const proposal_update_operation& o) void_result proposal_update_evaluator::do_apply(const proposal_update_operation& o)
{ {
database& d = db(); database& d = db();
@ -128,7 +128,7 @@ object_id_type proposal_update_evaluator::do_apply(const proposal_update_operati
// If the proposal has a review period, don't bother attempting to authorize/execute it. // If the proposal has a review period, don't bother attempting to authorize/execute it.
// Proposals with a review period may never be executed except at their expiration. // Proposals with a review period may never be executed except at their expiration.
if( _proposal->review_period_time ) if( _proposal->review_period_time )
return object_id_type(); return void_result();
if( _proposal->is_authorized_to_execute(&d) ) if( _proposal->is_authorized_to_execute(&d) )
{ {
@ -143,10 +143,10 @@ object_id_type proposal_update_evaluator::do_apply(const proposal_update_operati
} }
} }
return object_id_type(); return void_result();
} }
object_id_type proposal_delete_evaluator::do_evaluate(const proposal_delete_operation& o) void_result proposal_delete_evaluator::do_evaluate(const proposal_delete_operation& o)
{ {
database& d = db(); database& d = db();
@ -158,14 +158,14 @@ object_id_type proposal_delete_evaluator::do_evaluate(const proposal_delete_oper
"Provided authority is not authoritative for this proposal.", "Provided authority is not authoritative for this proposal.",
("provided", o.fee_paying_account)("required", *required_approvals)); ("provided", o.fee_paying_account)("required", *required_approvals));
return object_id_type(); return void_result();
} }
object_id_type proposal_delete_evaluator::do_apply(const proposal_delete_operation&) void_result proposal_delete_evaluator::do_apply(const proposal_delete_operation&)
{ {
db().remove(*_proposal); db().remove(*_proposal);
return object_id_type(); return void_result();
} }
} } // graphene::chain } } // graphene::chain

View file

@ -69,7 +69,7 @@ object_id_type vesting_balance_create_evaluator::do_apply( const vesting_balance
return vbo.id; return vbo.id;
} }
object_id_type vesting_balance_withdraw_evaluator::do_evaluate( const vesting_balance_withdraw_operation& op ) void_result vesting_balance_withdraw_evaluator::do_evaluate( const vesting_balance_withdraw_operation& op )
{ {
const database& d = db(); const database& d = db();
const time_point_sec now = d.head_block_time(); const time_point_sec now = d.head_block_time();
@ -81,10 +81,10 @@ object_id_type vesting_balance_withdraw_evaluator::do_evaluate( const vesting_ba
/* const account_object& owner_account = */ op.owner( d ); /* const account_object& owner_account = */ op.owner( d );
// TODO: Check asset authorizations and withdrawals // TODO: Check asset authorizations and withdrawals
return object_id_type(); return void_result();
} }
object_id_type vesting_balance_withdraw_evaluator::do_apply( const vesting_balance_withdraw_operation& op ) void_result vesting_balance_withdraw_evaluator::do_apply( const vesting_balance_withdraw_operation& op )
{ {
database& d = db(); database& d = db();
const time_point_sec now = d.head_block_time(); const time_point_sec now = d.head_block_time();
@ -103,7 +103,7 @@ object_id_type vesting_balance_withdraw_evaluator::do_apply( const vesting_balan
d.adjust_balance( op.owner, op.amount ); d.adjust_balance( op.owner, op.amount );
// TODO: Check asset authorizations and withdrawals // TODO: Check asset authorizations and withdrawals
return object_id_type(); return void_result();
} }
} } // graphene::chain } } // graphene::chain

View file

@ -45,7 +45,7 @@ object_id_type witness_create_evaluator::do_apply( const witness_create_operatio
return new_witness_object.id; return new_witness_object.id;
} }
object_id_type witness_withdraw_pay_evaluator::do_evaluate(const witness_withdraw_pay_evaluator::operation_type& o) void_result witness_withdraw_pay_evaluator::do_evaluate(const witness_withdraw_pay_evaluator::operation_type& o)
{ {
database& d = db(); database& d = db();
@ -55,10 +55,10 @@ object_id_type witness_withdraw_pay_evaluator::do_evaluate(const witness_withdra
("w", o.amount)("e", witness->accumulated_income) ); ("w", o.amount)("e", witness->accumulated_income) );
to_account = &d.get(o.to_account); to_account = &d.get(o.to_account);
return object_id_type(); return void_result();
} }
object_id_type witness_withdraw_pay_evaluator::do_apply(const witness_withdraw_pay_evaluator::operation_type& o) void_result witness_withdraw_pay_evaluator::do_apply(const witness_withdraw_pay_evaluator::operation_type& o)
{ {
database& d = db(); database& d = db();
@ -68,7 +68,7 @@ object_id_type witness_withdraw_pay_evaluator::do_apply(const witness_withdraw_p
w.accumulated_income -= o.amount; w.accumulated_income -= o.amount;
}); });
return object_id_type(); return void_result();
} }
} } // graphene::chain } } // graphene::chain

@ -1 +1 @@
Subproject commit 10e747409c5d656e794cb2e10cc51d5e31978cf1 Subproject commit dde8ed9d7ab49807f2556488c0815f3741b11e00