From c3353c27c2647510d9f715a29ceaffe3444dd63a Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Tue, 10 Jan 2023 15:33:36 -0600 Subject: [PATCH] verify acct size in index can easily be recalculated (#29601) --- runtime/src/accounts_db.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index d60022dc0d..52c5dd0614 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -7807,6 +7807,15 @@ impl AccountsDb { "AccountsDB::accounts_index corrupted. Storage pointed to: {}, expected: {}, should only point to one slot", store.slot(), *slot ); + let account = store.accounts.get_account(account_info.offset()).unwrap(); + if account.1 + != account_info + .offset() + .saturating_add(account_info.stored_size() as usize) + { + // this should never happen. This is a metrics based assert at the moment. + inc_new_counter_info!("remove_dead_accounts-stored_size_mismatch", 1); + } let count = store.remove_account(account_info.stored_size() as usize, reset_accounts); if count == 0 {