From 8ce6081744574e87611363ef43d2c9ec8c29211d Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Tue, 6 Dec 2022 16:34:40 -0600 Subject: [PATCH] test_accounts_db_purge1 uses write cache (#29100) --- runtime/src/accounts_db.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 4a97d9f36..62361fcb5 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -12337,25 +12337,29 @@ pub mod tests { let zero_lamport_account = AccountSharedData::new(zero_lamport, no_data, &owner); - let accounts = AccountsDb::new_single_for_tests(); + let mut accounts = AccountsDb::new_single_for_tests(); + accounts.caching_enabled = true; accounts.add_root(0); let mut current_slot = 1; accounts.insert_default_bank_hash(current_slot, current_slot - 1); accounts.store_for_tests(current_slot, &[(&pubkey, &account)]); - accounts.add_root(current_slot); + accounts.get_accounts_delta_hash(current_slot); + accounts.add_root_and_flush_write_cache(current_slot); current_slot += 1; accounts.insert_default_bank_hash(current_slot, current_slot - 1); accounts.store_for_tests(current_slot, &[(&pubkey, &zero_lamport_account)]); - accounts.add_root(current_slot); + accounts.get_accounts_delta_hash(current_slot); + accounts.add_root_and_flush_write_cache(current_slot); assert_load_account(&accounts, current_slot, pubkey, zero_lamport); // Otherwise slot 2 will not be removed current_slot += 1; accounts.insert_default_bank_hash(current_slot, current_slot - 1); - accounts.add_root(current_slot); + accounts.get_accounts_delta_hash(current_slot); + accounts.add_root_and_flush_write_cache(current_slot); accounts.print_accounts_stats("pre_purge");