Skip to content

Avoid database lookup and update when new ram is not issued with every block. #108

@greg7mdp

Description

@greg7mdp

Add an early return if _gstate2.new_ram_per_block == 0 which is the case now:

See also in eos-system-contracts

void system_contract::update_ram_supply() {
auto cbt = eosio::current_block_time();
if( cbt <= _gstate2.last_ram_increase ) return;
auto itr = _rammarket.find(ramcore_symbol.raw());
auto new_ram = (cbt.slot - _gstate2.last_ram_increase.slot)*_gstate2.new_ram_per_block;
_gstate.max_ram_size += new_ram;
/**
* Increase the amount of ram for sale based upon the change in max ram size.
*/
_rammarket.modify( itr, same_payer, [&]( auto& m ) {
m.base.balance.amount += new_ram;
});
_gstate2.last_ram_increase = cbt;
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions