remove unnecessary struct IndexAccountMapEntry (#31605)

This commit is contained in:
Jeff Washington (jwash) 2023-05-11 15:22:03 -05:00 committed by GitHub
parent e0b914e775
commit d9cfb31bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 39 deletions

View File

@ -2265,11 +2265,7 @@ impl<'a> ZeroLamport for StoredAccountMeta<'a> {
}
}
struct IndexAccountMapEntry<'a> {
pub stored_account: StoredAccountMeta<'a>,
}
type GenerateIndexAccountsMap<'a> = HashMap<Pubkey, IndexAccountMapEntry<'a>>;
type GenerateIndexAccountsMap<'a> = HashMap<Pubkey, StoredAccountMeta<'a>>;
/// called on a struct while scanning append vecs
trait AppendVecScan: Send + Sync + Clone {
@ -8735,7 +8731,7 @@ impl AccountsDb {
storage.accounts.account_iter().for_each(|stored_account| {
let pubkey = stored_account.pubkey();
assert!(!self.is_filler_account(pubkey));
accounts_map.insert(*pubkey, IndexAccountMapEntry { stored_account });
accounts_map.insert(*pubkey, stored_account);
});
accounts_map
}
@ -8776,10 +8772,7 @@ impl AccountsDb {
let mut num_accounts_rent_paying = 0;
let num_accounts = accounts_map.len();
let mut amount_to_top_off_rent = 0;
let items =
accounts_map
.into_iter()
.map(|(pubkey, IndexAccountMapEntry { stored_account })| {
let items = accounts_map.into_iter().map(|(pubkey, stored_account)| {
if secondary {
self.accounts_index.update_secondary_indexes(
&pubkey,
@ -9043,9 +9036,9 @@ impl AccountsDb {
let ai = AccountInfo::new(
StorageLocation::AppendVec(
store_id,
account_info.stored_account.offset(),
account_info.offset(),
), // will never be cached
account_info.stored_account.lamports(),
account_info.lamports(),
);
assert_eq!(&ai, account_info2);
}
@ -9283,7 +9276,7 @@ impl AccountsDb {
// first collect into a local HashMap with no lock contention
let mut storage_info_local = StorageSizeAndCount::default();
for (_, v) in accounts_map.iter() {
storage_info_local.stored_size += v.stored_account.stored_size();
storage_info_local.stored_size += v.stored_size();
storage_info_local.count += 1;
}
storage_size_accounts_map_time.stop();