From 4d999b0648c9b83e87de871fc1485cc0ecf45d05 Mon Sep 17 00:00:00 2001 From: Brooks Date: Wed, 18 Sep 2024 18:08:11 -0400 Subject: [PATCH] Uses actual number of items in generate_index_for_slot() (#2919) --- accounts-db/src/accounts_db.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index f863c81007b110..758a0a56b46c05 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -8860,6 +8860,7 @@ impl AccountsDb { } items_local.push(info.index_info); }); + let items_len = items_local.len(); let items = items_local.into_iter().map(|info| { if let Some(amount_to_top_off_rent_this_account) = Self::stats_for_rent_payers( &info.pubkey, @@ -8884,11 +8885,7 @@ impl AccountsDb { ) }); self.accounts_index - .insert_new_if_missing_into_primary_index( - slot, - storage.approx_stored_count(), - items, - ) + .insert_new_if_missing_into_primary_index(slot, items_len, items) }; if secondary { // scan storage a second time to update the secondary index