Prune fork_hashes with dead forks (#6085)

This commit is contained in:
sakridge 2019-09-25 11:16:14 -07:00 committed by GitHub
parent 678a5aff83
commit 093b5b5267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -902,9 +902,17 @@ impl AccountsDB {
// a fork is not totally dead until it is older than the root
dead_forks.retain(|fork| *fork < last_root);
if !dead_forks.is_empty() {
let mut index = self.accounts_index.write().unwrap();
for fork in dead_forks.iter() {
index.cleanup_dead_fork(*fork);
{
let mut index = self.accounts_index.write().unwrap();
for fork in dead_forks.iter() {
index.cleanup_dead_fork(*fork);
}
}
{
let mut fork_hashes = self.fork_hashes.write().unwrap();
for fork in dead_forks.iter() {
fork_hashes.remove(fork);
}
}
}
}