Skip to content

Commit

Permalink
Invoke ancient slots shrinking only if skipping rewrites is enabled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dmakarov authored Oct 22, 2024
1 parent 3ca4352 commit 8ff5dae
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6434,10 +6434,21 @@ impl Bank {
}

pub(crate) fn shrink_ancient_slots(&self) {
self.rc
let can_skip_rewrites = self.bank_hash_skips_rent_rewrites();
let test_skip_rewrites_but_include_in_bank_hash = self
.rc
.accounts
.accounts_db
.shrink_ancient_slots(self.epoch_schedule())
.test_skip_rewrites_but_include_in_bank_hash;
// Invoke ancient slot shrinking only when the validator is
// explicitly configured to do so. This condition may be
// removed when the skip rewrites feature is enabled.
if can_skip_rewrites || test_skip_rewrites_but_include_in_bank_hash {
self.rc
.accounts
.accounts_db
.shrink_ancient_slots(self.epoch_schedule())
}
}

pub fn read_cost_tracker(&self) -> LockResult<RwLockReadGuard<CostTracker>> {
Expand Down

0 comments on commit 8ff5dae

Please sign in to comment.