diff --git a/libraries/chain/evaluator.cpp b/libraries/chain/evaluator.cpp index 4a190963..878d98cb 100644 --- a/libraries/chain/evaluator.cpp +++ b/libraries/chain/evaluator.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -46,17 +47,25 @@ database& generic_evaluator::db()const { return trx_state->db(); } void generic_evaluator::prepare_fee(account_id_type account_id, asset fee) { + const database& d = db(); fee_from_account = fee; FC_ASSERT( fee.amount >= 0 ); - fee_paying_account = &account_id(db()); - fee_paying_account_statistics = &fee_paying_account->statistics(db()); + fee_paying_account = &account_id(d); + fee_paying_account_statistics = &fee_paying_account->statistics(d); - fee_asset = &fee.asset_id(db()); - fee_asset_dyn_data = &fee_asset->dynamic_asset_data_id(db()); + fee_asset = &fee.asset_id(d); + fee_asset_dyn_data = &fee_asset->dynamic_asset_data_id(d); + + if( d.head_block_time() > HARDFORK_419_TIME ) + { + FC_ASSERT( fee_paying_account->is_authorized_asset( *fee_asset, d ), "Account ${acct} '${name}' attempted to pay fee by using asset ${a} '${sym}', which is unauthorized due to whitelist / blacklist", + ("acct", fee_paying_account->id)("name", fee_paying_account->name)("a", fee_asset->id)("sym", fee_asset->symbol) ); + } if( fee_from_account.asset_id == asset_id_type() ) core_fee_paid = fee_from_account.amount; - else { + else + { asset fee_from_pool = fee_from_account * fee_asset->options.core_exchange_rate; FC_ASSERT( fee_from_pool.asset_id == asset_id_type() ); core_fee_paid = fee_from_pool.amount; diff --git a/libraries/chain/include/graphene/chain/hardfork.hpp b/libraries/chain/include/graphene/chain/hardfork.hpp index da94532d..821f9306 100644 --- a/libraries/chain/include/graphene/chain/hardfork.hpp +++ b/libraries/chain/include/graphene/chain/hardfork.hpp @@ -24,3 +24,4 @@ #define HARDFORK_359_TIME (fc::time_point_sec( 1444416300 )) #define HARDFORK_415_TIME (fc::time_point_sec( 1446652800 )) #define HARDFORK_416_TIME (fc::time_point_sec( 1446652800 )) +#define HARDFORK_419_TIME (fc::time_point_sec( 1446652800 )) diff --git a/libraries/chain/transfer_evaluator.cpp b/libraries/chain/transfer_evaluator.cpp index 521f2f55..0f1a1f3c 100644 --- a/libraries/chain/transfer_evaluator.cpp +++ b/libraries/chain/transfer_evaluator.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace graphene { namespace chain { void_result transfer_evaluator::do_evaluate( const transfer_operation& op ) @@ -53,8 +54,12 @@ void_result transfer_evaluator::do_evaluate( const transfer_operation& op ) ); } - if( fee_asset_type.options.flags & white_list ) - FC_ASSERT( from_account.is_authorized_asset( asset_type, d ) ); + if( d.head_block_time() <= HARDFORK_419_TIME ) + { + if( fee_asset_type.options.flags & white_list ) + FC_ASSERT( from_account.is_authorized_asset( asset_type, d ) ); + } + // the above becomes no-op after hardfork because this check will then be performed in evaluator if( asset_type.is_transfer_restricted() ) { @@ -108,8 +113,12 @@ void_result override_transfer_evaluator::do_evaluate( const override_transfer_op FC_ASSERT( from_account.is_authorized_asset( asset_type, d ) ); } - if( fee_asset_type.options.flags & white_list ) - FC_ASSERT( from_account.is_authorized_asset( asset_type, d ) ); + if( d.head_block_time() <= HARDFORK_419_TIME ) + { + if( fee_asset_type.options.flags & white_list ) + FC_ASSERT( from_account.is_authorized_asset( asset_type, d ) ); + } + // the above becomes no-op after hardfork because this check will then be performed in evaluator 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) );