From 04eb5d414da4b9a7cc415d0cac8f4d045bccb985 Mon Sep 17 00:00:00 2001 From: Brooks Prumo Date: Mon, 22 Aug 2022 18:36:25 -0400 Subject: [PATCH] Remove unused `Bank::_clean_accounts()` (#27262) --- runtime/src/bank.rs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index cc010961eb..1d99958b31 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -7457,28 +7457,22 @@ impl Bank { debug!("Added precompiled program {:?}", program_id); } + // Call AccountsDb::clean_accounts() + // + // This fn is meant to be called by the snapshot handler in Accounts Background Service. If + // calling from elsewhere, ensure the same invariants hold/expectations are met. pub(crate) fn clean_accounts(&self, last_full_snapshot_slot: Option) { // Don't clean the slot we're snapshotting because it may have zero-lamport // accounts that were included in the bank delta hash when the bank was frozen, // and if we clean them here, any newly created snapshot's hash for this bank // may not match the frozen hash. // - // So when we're snapshotting, set `skip_last` to true so the highest slot to clean is - // lowered by one. - self._clean_accounts(true, false, last_full_snapshot_slot) - } - - fn _clean_accounts( - &self, - skip_last: bool, - is_startup: bool, - last_full_snapshot_slot: Option, - ) { - let max_clean_root = skip_last.then(|| self.slot().saturating_sub(1)); + // So when we're snapshotting, the highest slot to clean is lowered by one. + let highest_slot_to_clean = self.slot().saturating_sub(1); self.rc.accounts.accounts_db.clean_accounts( - max_clean_root, - is_startup, + Some(highest_slot_to_clean), + false, last_full_snapshot_slot, ); }