in_mem_accounts_index filters by range (#19779)

This commit is contained in:
Jeff Washington (jwash)
2021-09-12 21:57:15 -05:00
committed by GitHub
parent 0263ffb2ed
commit b992c02708
3 changed files with 17 additions and 11 deletions

View File

@@ -559,14 +559,9 @@ impl<'a, T: IsCached> AccountsIndexIterator<'a, T> {
collect_all_unsorted: bool,
) -> Vec<(Pubkey, AccountMapEntry<T>)>
where
R: RangeBounds<Pubkey>,
R: RangeBounds<Pubkey> + std::fmt::Debug,
{
let mut result = Vec::with_capacity(map.len());
for (k, v) in map.items() {
if range.contains(&k) {
result.push((k, v));
}
}
let mut result = map.items(&Some(&range));
if !collect_all_unsorted {
result.sort_unstable_by(|a, b| a.0.cmp(&b.0));
}