latest_slot uses > current_max (#16374)

This commit is contained in:
Jeff Washington (jwash) 2021-04-12 09:52:24 -06:00 committed by GitHub
parent 6930a77a0f
commit 7ba3e710d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -755,7 +755,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
if let Some(ancestors) = ancestors {
if !ancestors.is_empty() {
for (i, (slot, _t)) in slice.iter().rev().enumerate() {
if *slot >= current_max && ancestors.contains_key(slot) {
if (rv.is_none() || *slot > current_max) && ancestors.contains_key(slot) {
rv = Some(i);
current_max = *slot;
}
@ -767,7 +767,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
let mut tracker = None;
for (i, (slot, _t)) in slice.iter().rev().enumerate() {
if *slot >= current_max && *slot <= max_root {
if (rv.is_none() || *slot > current_max) && *slot <= max_root {
let lock = match tracker {
Some(inner) => inner,
None => self.roots_tracker.read().unwrap(),