From 5bb75a5894778c13006d7ad33a5a6c9a1e2fa56a Mon Sep 17 00:00:00 2001 From: carllin Date: Fri, 3 May 2019 15:17:37 -0700 Subject: [PATCH] Fix roots never being purged (#4134) --- runtime/src/accounts_index.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index 90428c3e5d..c4dec064bf 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -60,7 +60,7 @@ impl AccountsIndex { rv } pub fn is_purged(&self, fork: Fork) -> bool { - !self.is_root(fork) && fork < self.last_root + fork < self.last_root } pub fn is_root(&self, fork: Fork) -> bool { self.roots.contains(&fork) @@ -152,6 +152,8 @@ mod tests { assert!(!index.is_purged(0)); index.add_root(1); assert!(index.is_purged(0)); + index.add_root(2); + assert!(index.is_purged(1)); } #[test]