Prune fork_hashes with dead forks (#6085)
This commit is contained in:
		@@ -902,11 +902,19 @@ impl AccountsDB {
 | 
				
			|||||||
        // a fork is not totally dead until it is older than the root
 | 
					        // a fork is not totally dead until it is older than the root
 | 
				
			||||||
        dead_forks.retain(|fork| *fork < last_root);
 | 
					        dead_forks.retain(|fork| *fork < last_root);
 | 
				
			||||||
        if !dead_forks.is_empty() {
 | 
					        if !dead_forks.is_empty() {
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                let mut index = self.accounts_index.write().unwrap();
 | 
					                let mut index = self.accounts_index.write().unwrap();
 | 
				
			||||||
                for fork in dead_forks.iter() {
 | 
					                for fork in dead_forks.iter() {
 | 
				
			||||||
                    index.cleanup_dead_fork(*fork);
 | 
					                    index.cleanup_dead_fork(*fork);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                let mut fork_hashes = self.fork_hashes.write().unwrap();
 | 
				
			||||||
 | 
					                for fork in dead_forks.iter() {
 | 
				
			||||||
 | 
					                    fork_hashes.remove(fork);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn hash_accounts(&self, fork_id: Fork, accounts: &[(&Pubkey, &Account)]) -> Vec<Hash> {
 | 
					    fn hash_accounts(&self, fork_id: Fork, accounts: &[(&Pubkey, &Account)]) -> Vec<Hash> {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user