Skip to content

Commit

Permalink
fix build after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Feb 13, 2025
1 parent 0fe2226 commit 70c050f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions accounts-db/src/accounts_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,15 +623,11 @@ impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> Iterator
}
_ => {
// else load the new bin
Self::range(
&map,
(self.start_bound, self.end_bound),
self.collect_all_unsorted,
)
Self::range(&map, (self.start_bound, self.end_bound), self.returns_items)
}
};
for (count, (pubkey, account_map_entry)) in range.iter().enumerate() {
if chunk.len() >= ITER_BATCH_SIZE && !self.collect_all_unsorted {
if chunk.len() >= ITER_BATCH_SIZE && self.returns_items.is_sorted() {
range.drain(0..count);
self.last_bin_range = Some((bin, range));
break 'outer;
Expand Down Expand Up @@ -665,6 +661,12 @@ pub enum AccountsIndexIteratorReturnsItems {
Sorted,
}

impl AccountsIndexIteratorReturnsItems {
pub fn is_sorted(&self) -> bool {
*self == AccountsIndexIteratorReturnsItems::Sorted
}
}

pub trait ZeroLamport {
fn is_zero_lamport(&self) -> bool;
}
Expand Down Expand Up @@ -3954,7 +3956,10 @@ pub mod tests {
}

// Create an iterator for the whole pubkey range.
let mut iter = index.iter(None::<&Range<Pubkey>>, COLLECT_ALL_UNSORTED_FALSE);
let mut iter = index.iter(
None::<&Range<Pubkey>>,
AccountsIndexIteratorReturnsItems::Sorted,
);
// First iter.next() should return the first batch of pubkeys (1000
// pubkeys) out of the 2000 pubkeys in the first bin. And the remaining
// 1000 pubkeys from the first bin should be cached in
Expand Down

0 comments on commit 70c050f

Please sign in to comment.