Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
reviews - move should collect rent check out of rent collector into bank
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Nov 14, 2023
1 parent 96f124c commit 52b84e5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 291 deletions.
3 changes: 1 addition & 2 deletions accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,13 @@ impl Accounts {
self.accounts_db
.load_with_fixed_root(ancestors, key)
.map(|(mut account, _)| {
if message.is_writable(i) {
if should_collect_rent && message.is_writable(i) {
let rent_due = rent_collector
.collect_from_existing_account(
key,
&mut account,
self.accounts_db.filler_account_suffix.as_ref(),
set_exempt_rent_epoch_max,
should_collect_rent,
)
.rent_amount;
(account.data().len(), account, rent_due)
Expand Down
6 changes: 1 addition & 5 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9000,11 +9000,7 @@ impl AccountsDb {
return None;
}
(rent_collector.should_collect_rent(pubkey, account)
&& !rent_collector
.get_rent_due(
account, true, /* For rent stats, we want to always calculate rent. */
)
.is_exempt())
&& !rent_collector.get_rent_due(account).is_exempt())
.then(|| {
let min_balance = rent_collector.rent.minimum_balance(account.data().len());
// return lamports required to top off this account to make it rent exempt
Expand Down
Loading

0 comments on commit 52b84e5

Please sign in to comment.