account storage is not in sync with the index after gc (#3914)

* account storage is not in sync with the index after gc

* builds

* clippy fmt

* test

* purge dead forks on store

* rm println

* also fixed count_stores

* comments
This commit is contained in:
anatoly yakovenko
2019-04-20 20:50:50 -05:00
committed by GitHub
parent 349e8a9462
commit 101d6b92ee
3 changed files with 206 additions and 151 deletions

View File

@@ -9,7 +9,7 @@ pub struct AccountsIndex<T> {
account_maps: HashMap<Pubkey, Vec<(Fork, T)>>,
roots: HashSet<Fork>,
//This value that needs to be stored to recover the index from AppendVec
last_root: Fork,
pub last_root: Fork,
}
impl<T: Clone> AccountsIndex<T> {
@@ -59,7 +59,7 @@ impl<T: Clone> AccountsIndex<T> {
};
rv
}
fn is_purged(&self, fork: Fork) -> bool {
pub fn is_purged(&self, fork: Fork) -> bool {
!self.is_root(fork) && fork < self.last_root
}
pub fn is_root(&self, fork: Fork) -> bool {