未验证 提交 393546bd 编写于 作者: A Anton Perkov 提交者: GitHub

Merge pull request #3416 from EOSIO/eosio-buyram-fix

bugifxes: delegated bandwidth #3366, buyram from eos #3414
......@@ -117,7 +117,7 @@ namespace eosiosystem {
{ payer, N(eosio.ram), quant_after_fee, std::string("buy ram") } );
}
if( fee.amount > 0 ) {
if( payer != N(eosio) && fee.amount > 0 ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {payer,N(active)},
{ payer, N(eosio.ramfee), fee, std::string("ram fee") } );
}
......@@ -259,7 +259,7 @@ namespace eosiosystem {
set_resource_limits( receiver, tot_itr->ram_bytes, tot_itr->net_weight.amount, tot_itr->cpu_weight.amount );
if ( tot_itr->net_weight == asset(0) && tot_itr->cpu_weight == asset(0) ) {
if ( tot_itr->net_weight == asset(0) && tot_itr->cpu_weight == asset(0) && tot_itr->ram_bytes == 0 ) {
totals_tbl.erase( tot_itr );
}
} // tot_itr can be invalid, should go out of scope
......
......@@ -396,9 +396,8 @@ account_resource_limit resource_limits_manager::get_account_cpu_limit_ex( const
const auto& state = _db.get<resource_limits_state_object>();
const auto& usage = _db.get<resource_usage_object, by_owner>(name);
int64_t x;
int64_t cpu_weight;
get_account_limits( name, x, x, cpu_weight );
int64_t cpu_weight, x, y;
get_account_limits( name, x, y, cpu_weight );
if( cpu_weight < 0 || state.total_cpu_weight == 0 ) {
return { -1, -1, -1 };
......@@ -412,8 +411,6 @@ account_resource_limit resource_limits_manager::get_account_cpu_limit_ex( const
uint128_t user_weight = cpu_weight;
uint128_t all_user_weight = state.total_cpu_weight;
wdump((cpu_weight));
auto max_user_use_in_window = (uint128_t(virtual_cpu_capacity_in_window) * user_weight) / all_user_weight;
auto cpu_used_in_window = (usage.cpu_usage.value_ex * window_size) / config::rate_limiting_precision;
......@@ -460,9 +457,8 @@ account_resource_limit resource_limits_manager::get_account_net_limit_ex( const
const auto& state = _db.get<resource_limits_state_object>();
const auto& usage = _db.get<resource_usage_object, by_owner>(name);
int64_t x;
int64_t net_weight;
get_account_limits( name, x, net_weight, x );
int64_t net_weight, x, y;
get_account_limits( name, x, net_weight, y );
if( net_weight < 0 || state.total_net_weight == 0) {
return { -1, -1, -1 };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册