accounts index keys returns by value (#19858)
This commit is contained in:
parent
46d1b61902
commit
2a795614d3
|
@ -4797,7 +4797,7 @@ impl AccountsDb {
|
|||
.account_maps
|
||||
.iter()
|
||||
.map(|map| {
|
||||
let mut keys = map.read().unwrap().keys().cloned().collect::<Vec<_>>();
|
||||
let mut keys = map.read().unwrap().keys();
|
||||
keys.sort_unstable(); // hashmap is not ordered, but bins are relative to each other
|
||||
keys
|
||||
})
|
||||
|
|
|
@ -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<T: IsCached> InMemAccountsIndex<T> {
|
|||
result
|
||||
}
|
||||
|
||||
pub fn keys(&self) -> Keys<K, AccountMapEntry<T>> {
|
||||
pub fn keys(&self) -> Vec<Pubkey> {
|
||||
Self::update_stat(&self.stats().keys, 1);
|
||||
self.map.keys()
|
||||
self.map.keys().cloned().collect()
|
||||
}
|
||||
|
||||
pub fn get(&self, key: &K) -> Option<AccountMapEntry<T>> {
|
||||
|
|
Loading…
Reference in New Issue