Skip to content

Commit

Permalink
fix last_ram_increase
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Jan 5, 2024
1 parent 278405e commit 2d2fe0e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions contracts/eosio.system/src/eosio.system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int64_t>(cbt.slot - _gstate2.last_ram_increase.slot) * _gstate2.new_ram_per_block;
int64_t new_ram = static_cast<int64_t>(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;

Expand Down

0 comments on commit 2d2fe0e

Please sign in to comment.