From 2d2fe0ef90cc9448f65fe67618731e76a760cfec Mon Sep 17 00:00:00 2001 From: Denis Carriere Date: Fri, 5 Jan 2024 00:36:40 -0500 Subject: [PATCH] fix last_ram_increase --- contracts/eosio.system/src/eosio.system.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contracts/eosio.system/src/eosio.system.cpp b/contracts/eosio.system/src/eosio.system.cpp index cf2ab48..29adddb 100644 --- a/contracts/eosio.system/src/eosio.system.cpp +++ b/contracts/eosio.system/src/eosio.system.cpp @@ -85,14 +85,15 @@ namespace eosiosystem { } void system_contract::update_ram_supply() { - auto cbt = eosio::current_block_time(); + const block_timestamp cbt = eosio::current_block_time(); + const block_timestamp last_ram_increase = _gstate2.last_ram_increase - if( cbt <= _gstate2.last_ram_increase ) return; + if( cbt <= last_ram_increase ) return; _gstate2.last_ram_increase = cbt; // set timestamp of last ram increase/decrease or no change - // if ( _gstate2.new_ram_per_block == 0 ) return; // no new ram is issued + if ( _gstate2.new_ram_per_block == 0 ) return; // no new ram is issued auto itr = _rammarket.find(ramcore_symbol.raw()); - int64_t new_ram = static_cast(cbt.slot - _gstate2.last_ram_increase.slot) * _gstate2.new_ram_per_block; + int64_t new_ram = static_cast(cbt.slot - last_ram_increase.slot) * _gstate2.new_ram_per_block; // if ( _gstate.max_ram_size + new_ram < _gstate.total_ram_bytes_reserved ) return; // no ram left to issue _gstate.max_ram_size += new_ram;