handle unclean roots explicitly during index generation (#29230)

This commit is contained in:
Jeff Washington (jwash) 2022-12-13 09:51:33 -06:00 committed by GitHub
parent b779134020
commit 1a0a465416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -9212,12 +9212,10 @@ impl AccountsDb {
let uncleaned_roots = uncleaned_roots.into_inner().unwrap();
// Need to add these last, otherwise older updates will be cleaned
for root in &slots {
// passing 'false' to 'add_root' causes 'root' to be added to 'accounts_index.roots_tracker.uncleaned_roots'
// passing 'true' to 'add_root' does NOT add 'root' to 'accounts_index.roots_tracker.uncleaned_roots'
// So, don't add all slots to 'uncleaned_roots' here since we know which slots contain duplicate pubkeys.
let uncleaned_root = uncleaned_roots.contains(root);
self.accounts_index.add_root(*root, !uncleaned_root);
self.accounts_index.add_root(*root, true);
}
self.accounts_index
.add_uncleaned_roots(uncleaned_roots.into_iter());
self.set_storage_count_and_alive_bytes(storage_info, &mut timings);
}