Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #1067
greg7mdp opened this issue Jan 16, 2025 · 0 comments · Fixed by #110
Closed
Tracked by #1067

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

greg7mdp opened this issue Jan 16, 2025 · 0 comments · Fixed by #110
Assignees

Comments

@greg7mdp
Copy link
Contributor

greg7mdp commented Jan 16, 2025

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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants