Skip to content

Commit

Permalink
v2.0: Invoke ancient slots shrinking only if skipping rewrites is ena…
Browse files Browse the repository at this point in the history
…bled (backport of #3266) (#3580)

Invoke ancient slots shrinking only if skipping rewrites is enabled (#3266)

(cherry picked from commit 8ff5dae)

Co-authored-by: dmakarov <[email protected]>
  • Loading branch information
mergify[bot] and dmakarov authored Nov 13, 2024
1 parent 2408949 commit 79f23b6
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 @@ -6300,10 +6300,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 validate_fee_collector_account(&self) -> bool {
Expand Down

0 comments on commit 79f23b6

Please sign in to comment.