diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 5febd52a91..3074bb4f0e 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -4797,7 +4797,7 @@ impl AccountsDb { .account_maps .iter() .map(|map| { - let mut keys = map.read().unwrap().keys().cloned().collect::>(); + let mut keys = map.read().unwrap().keys(); keys.sort_unstable(); // hashmap is not ordered, but bins are relative to each other keys }) diff --git a/runtime/src/in_mem_accounts_index.rs b/runtime/src/in_mem_accounts_index.rs index 4f19acc7e1..b2f5897448 100644 --- a/runtime/src/in_mem_accounts_index.rs +++ b/runtime/src/in_mem_accounts_index.rs @@ -6,10 +6,7 @@ use crate::bucket_map_holder::BucketMapHolder; use crate::bucket_map_holder_stats::BucketMapHolderStats; use solana_measure::measure::Measure; use solana_sdk::{clock::Slot, pubkey::Pubkey}; -use std::collections::{ - hash_map::{Entry, Keys}, - HashMap, -}; +use std::collections::{hash_map::Entry, HashMap}; use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::Arc; @@ -67,9 +64,9 @@ impl InMemAccountsIndex { result } - pub fn keys(&self) -> Keys> { + pub fn keys(&self) -> Vec { Self::update_stat(&self.stats().keys, 1); - self.map.keys() + self.map.keys().cloned().collect() } pub fn get(&self, key: &K) -> Option> {