From 836494fc5f578625df4fac70c33c4a11884035dd Mon Sep 17 00:00:00 2001 From: Brooks Date: Tue, 21 Mar 2023 11:49:49 -0400 Subject: [PATCH] Cleans *up to* the last full snapshot slot in verify_snapshot_bank() (#30818) Cleans up to the last full snapshot slot in verify_snapshot_bank() --- runtime/src/bank.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6b331fb127..96e54cb16e 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -7328,8 +7328,12 @@ impl Bank { let should_clean = !accounts_db_skip_shrink && self.slot() > 0; if should_clean { info!("Cleaning..."); + // We cannot clean past the last full snapshot's slot because we are about to + // perform an accounts hash calculation *up to that slot*. If we cleaned *past* + // that slot, then accounts could be removed from older storages, which would + // change the accounts hash. self.rc.accounts.accounts_db.clean_accounts( - None, + Some(last_full_snapshot_slot), true, Some(last_full_snapshot_slot), );