Remove now-redundant white_list bit check from evaluators #566

This commit is contained in:
theoreticalbts 2016-02-11 03:12:18 -05:00
parent bb47f4c71c
commit 6f7f2605c1
4 changed files with 26 additions and 63 deletions

View file

@ -153,11 +153,7 @@ void_result asset_issue_evaluator::do_evaluate( const asset_issue_operation& o )
FC_ASSERT( !a.is_market_issued(), "Cannot manually issue a market-issued asset." );
to_account = &o.issue_to_account(d);
if( a.options.flags & white_list )
{
FC_ASSERT( is_authorized_asset( d, *to_account, a ) );
}
FC_ASSERT( is_authorized_asset( d, *to_account, a ) );
asset_dyn_data = &a.dynamic_asset_data_id(d);
FC_ASSERT( (asset_dyn_data->current_supply + o.asset_to_issue.amount) <= a.options.max_supply );
@ -189,11 +185,7 @@ void_result asset_reserve_evaluator::do_evaluate( const asset_reserve_operation&
);
from_account = &o.payer(d);
if( a.options.flags & white_list )
{
FC_ASSERT( is_authorized_asset( d, *from_account, a ) );
}
FC_ASSERT( is_authorized_asset( d, *from_account, a ) );
asset_dyn_data = &a.dynamic_asset_data_id(d);
FC_ASSERT( (asset_dyn_data->current_supply - o.amount_to_reserve.amount) >= 0 );

View file

@ -52,16 +52,8 @@ void_result limit_order_create_evaluator::do_evaluate(const limit_order_create_o
if( _sell_asset->options.blacklist_markets.size() )
FC_ASSERT( _sell_asset->options.blacklist_markets.find(_receive_asset->id) == _sell_asset->options.blacklist_markets.end() );
if( d.head_block_time() <= HARDFORK_416_TIME )
{
if( _sell_asset->options.flags & white_list ) FC_ASSERT( is_authorized_asset( d, *_seller, *_sell_asset ) );
if( _receive_asset->options.flags & white_list ) FC_ASSERT( is_authorized_asset( d, *_seller, *_receive_asset ) );
}
else
{
FC_ASSERT( is_authorized_asset( d, *_seller, *_sell_asset ) );
FC_ASSERT( is_authorized_asset( d, *_seller, *_receive_asset ) );
}
FC_ASSERT( is_authorized_asset( d, *_seller, *_sell_asset ) );
FC_ASSERT( is_authorized_asset( d, *_seller, *_receive_asset ) );
FC_ASSERT( d.get_balance( *_seller, *_sell_asset ) >= op.amount_to_sell, "insufficient balance",
("balance",d.get_balance(*_seller,*_sell_asset))("amount_to_sell",op.amount_to_sell) );

View file

@ -40,28 +40,24 @@ void_result transfer_evaluator::do_evaluate( const transfer_operation& op )
try {
if( asset_type.options.flags & white_list )
{
GRAPHENE_ASSERT(
is_authorized_asset( d, from_account, asset_type ),
transfer_from_account_not_whitelisted,
"'from' account ${from} is not whitelisted for asset ${asset}",
("from",op.from)
("asset",op.amount.asset_id)
);
GRAPHENE_ASSERT(
is_authorized_asset( d, to_account, asset_type ),
transfer_to_account_not_whitelisted,
"'to' account ${to} is not whitelisted for asset ${asset}",
("to",op.to)
("asset",op.amount.asset_id)
);
}
GRAPHENE_ASSERT(
is_authorized_asset( d, from_account, asset_type ),
transfer_from_account_not_whitelisted,
"'from' account ${from} is not whitelisted for asset ${asset}",
("from",op.from)
("asset",op.amount.asset_id)
);
GRAPHENE_ASSERT(
is_authorized_asset( d, to_account, asset_type ),
transfer_to_account_not_whitelisted,
"'to' account ${to} is not whitelisted for asset ${asset}",
("to",op.to)
("asset",op.amount.asset_id)
);
if( d.head_block_time() <= HARDFORK_419_TIME )
{
if( fee_asset_type.options.flags & white_list )
FC_ASSERT( is_authorized_asset( d, from_account, asset_type ) );
FC_ASSERT( is_authorized_asset( d, from_account, asset_type ) );
}
// the above becomes no-op after hardfork because this check will then be performed in evaluator
@ -111,16 +107,12 @@ void_result override_transfer_evaluator::do_evaluate( const override_transfer_op
const account_object& to_account = op.to(d);
const asset_object& fee_asset_type = op.fee.asset_id(d);
if( asset_type.options.flags & white_list )
{
FC_ASSERT( is_authorized_asset( d, to_account, asset_type ) );
FC_ASSERT( is_authorized_asset( d, from_account, asset_type ) );
}
FC_ASSERT( is_authorized_asset( d, to_account, asset_type ) );
FC_ASSERT( is_authorized_asset( d, from_account, asset_type ) );
if( d.head_block_time() <= HARDFORK_419_TIME )
{
if( fee_asset_type.options.flags & white_list )
FC_ASSERT( is_authorized_asset( d, from_account, asset_type ) );
FC_ASSERT( is_authorized_asset( d, from_account, asset_type ) );
}
// the above becomes no-op after hardfork because this check will then be performed in evaluator

View file

@ -70,23 +70,10 @@ void_result withdraw_permission_claim_evaluator::do_evaluate(const withdraw_perm
const asset_object& _asset = op.amount_to_withdraw.asset_id(d);
if( _asset.is_transfer_restricted() ) FC_ASSERT( _asset.issuer == permit.authorized_account || _asset.issuer == permit.withdraw_from_account );
if( d.head_block_time() <= HARDFORK_416_TIME )
{
if( _asset.options.flags & white_list )
{
const account_object& from = op.withdraw_to_account(d);
const account_object& to = permit.authorized_account(d);
FC_ASSERT( is_authorized_asset( d, to, _asset ) );
FC_ASSERT( is_authorized_asset( d, from, _asset ) );
}
}
else
{
const account_object& from = op.withdraw_to_account(d);
const account_object& to = permit.authorized_account(d);
FC_ASSERT( is_authorized_asset( d, to, _asset ) );
FC_ASSERT( is_authorized_asset( d, from, _asset ) );
}
const account_object& from = op.withdraw_to_account(d);
const account_object& to = permit.authorized_account(d);
FC_ASSERT( is_authorized_asset( d, to, _asset ) );
FC_ASSERT( is_authorized_asset( d, from, _asset ) );
return void_result();
} FC_CAPTURE_AND_RETHROW( (op) ) }