diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 7b331ae377..f5110d73b4 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -13144,7 +13144,8 @@ pub mod tests { #[test] fn test_get_snapshot_storages_only_non_empty() { - let db = AccountsDb::new(Vec::new(), &ClusterType::Development); + let mut db = AccountsDb::new(Vec::new(), &ClusterType::Development); + db.caching_enabled = true; let key = Pubkey::default(); let account = AccountSharedData::new(1, 0, &key); @@ -13152,16 +13153,11 @@ pub mod tests { let after_slot = base_slot + 1; db.store_for_tests(base_slot, &[(&key, &account)]); - db.storage - .get_slot_stores(base_slot) - .unwrap() - .write() - .unwrap() - .clear(); - db.add_root(base_slot); + // stored account is in write cache, so no storages yet assert!(db.get_snapshot_storages(..=after_slot, None).0.is_empty()); db.store_for_tests(base_slot, &[(&key, &account)]); + db.add_root_and_flush_write_cache(base_slot); assert_eq!(1, db.get_snapshot_storages(..=after_slot, None).0.len()); }