From e8a8f4e9e25527dc6e4fe48d57e36b9734ee2a16 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Mon, 14 Mar 2022 09:57:44 -0500 Subject: [PATCH] fix filler acct slots in epoch (#23536) --- runtime/src/accounts_db.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 86689345bf..ab9f391e6d 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -6841,11 +6841,17 @@ impl AccountsDb { return; } + let max_root_inclusive = self.accounts_index.max_root_inclusive(); + let epoch = epoch_schedule.get_epoch(max_root_inclusive); + info!("adding {} filler accounts", self.filler_account_count); // break this up to force the accounts out of memory after each pass let passes = 100; let mut roots = self.storage.all_slots(); - Self::retain_roots_within_one_epoch_range(&mut roots, epoch_schedule.slots_per_epoch); + Self::retain_roots_within_one_epoch_range( + &mut roots, + epoch_schedule.get_slots_in_epoch(epoch), + ); let root_count = roots.len(); let per_pass = std::cmp::max(1, root_count / passes); let overall_index = AtomicUsize::new(0);