diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index d99fff5c29..0b18684c86 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -5054,14 +5054,16 @@ impl AccountsDb { } } drop(lock); - for (pubkey, account_infos) in accounts_map.into_iter() { - for (_, (_store_id, stored_account)) in account_infos.iter() { - self.accounts_index.update_secondary_indexes( - &pubkey, - &stored_account.account_meta.owner, - &stored_account.data, - &self.account_indexes, - ); + if !self.account_indexes.is_empty() { + for (pubkey, account_infos) in accounts_map.into_iter() { + for (_, (_store_id, stored_account)) in account_infos.iter() { + self.accounts_index.update_secondary_indexes( + &pubkey, + &stored_account.account_meta.owner, + &stored_account.data, + &self.account_indexes, + ); + } } } }