test_accounts_db_serialize_zero_and_free uses write cache (#29102)

This commit is contained in:
Jeff Washington (jwash) 2022-12-06 12:25:07 -06:00 committed by GitHub
parent 7180345ee1
commit 5d0d4a6b95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 12 deletions

View File

@ -12381,7 +12381,8 @@ pub mod tests {
let filler_account = AccountSharedData::new(some_lamport, no_data, &owner);
let filler_account_pubkey = solana_sdk::pubkey::new_rand();
let accounts = AccountsDb::new_single_for_tests();
let mut accounts = AccountsDb::new_single_for_tests();
accounts.caching_enabled = true;
let mut current_slot = 1;
accounts.store_for_tests(current_slot, &[(&pubkey, &account)]);
@ -12391,19 +12392,13 @@ pub mod tests {
accounts.store_for_tests(current_slot, &[(&pubkey, &zero_lamport_account)]);
accounts.store_for_tests(current_slot, &[(&pubkey2, &account2)]);
// Store enough accounts such that an additional store for slot 2 is created.
while accounts
.storage
.get_slot_stores(current_slot)
.unwrap()
.read()
.unwrap()
.len()
< 2
{
// Store the account a few times.
// use to be: store enough accounts such that an additional store for slot 2 is created.
// but we use the write cache now
for _ in 0..3 {
accounts.store_for_tests(current_slot, &[(&filler_account_pubkey, &filler_account)]);
}
accounts.add_root(current_slot);
accounts.add_root_and_flush_write_cache(current_slot);
assert_load_account(&accounts, current_slot, pubkey, zero_lamport);