* cleanup

* cargo
This commit is contained in:
Jeff Washington (jwash) 2022-04-23 08:28:49 -05:00 committed by GitHub
parent 14ee36a2af
commit 8bfde0940f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -1791,12 +1791,13 @@ impl<T: IndexValue> AccountsIndex<T> {
/// This function exists to clean older entries from 'historical_roots'.
/// all roots < 'oldest_slot_to_keep' are removed from 'historical_roots'.
pub fn remove_old_historical_roots(&self, oldest_slot_to_keep: Slot, keep: &HashSet<Slot>) {
let w_roots_tracker = self.roots_tracker.read().unwrap();
let mut roots = w_roots_tracker
let mut roots = self
.roots_tracker
.read()
.unwrap()
.historical_roots
.get_all_less_than(oldest_slot_to_keep);
roots.retain(|root| !keep.contains(root));
drop(w_roots_tracker);
if !roots.is_empty() {
let mut w_roots_tracker = self.roots_tracker.write().unwrap();
roots.into_iter().for_each(|root| {