AcctIdx: held ranges search in lifo order (#21964)

This commit is contained in:
Jeff Washington (jwash) 2021-12-16 23:25:22 -06:00 committed by GitHub
parent 5d40da5688
commit c4389a6675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -654,7 +654,8 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
ranges.push(inclusive_range); ranges.push(inclusive_range);
} else { } else {
// find the matching range and delete it since we don't want to hold it anymore // find the matching range and delete it since we don't want to hold it anymore
for (i, r) in ranges.iter().enumerate() { // search backwards, assuming LIFO ordering
for (i, r) in ranges.iter().enumerate().rev() {
if let (Bound::Included(start_found), Bound::Included(end_found)) = if let (Bound::Included(start_found), Bound::Included(end_found)) =
(r.start_bound(), r.end_bound()) (r.start_bound(), r.end_bound())
{ {