Find max root and purge roots below it. (#4645)

* Test for forking accounts

* Find max root and purge roots below it.
This commit is contained in:
sakridge
2019-06-13 17:35:16 -07:00
committed by GitHub
parent 34c0537e9b
commit 9e3758983d
3 changed files with 74 additions and 26 deletions

View File

@ -1219,14 +1219,7 @@ mod tests {
.clone();
//fork 0 is behind root, but it is not root, therefore it is purged
accounts.add_root(1);
{
let accounts_index = accounts.accounts_index.read().unwrap();
assert!(AccountsIndex::<AccountInfo>::is_purged(
&accounts_index.roots,
accounts_index.last_root,
0
));
}
assert!(accounts.accounts_index.read().unwrap().is_purged(0));
//fork is still there, since gc is lazy
assert!(accounts.storage.read().unwrap().0[&0]