test_bank_hash_internal_state works with write cache (#29042)

This commit is contained in:
Jeff Washington (jwash) 2022-12-02 11:37:22 -06:00 committed by GitHub
parent d17a740a99
commit 87a3130226
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -11662,12 +11662,16 @@ pub(crate) mod tests {
assert_eq!(bank0.hash_internal_state(), bank1.hash_internal_state());
// Checkpointing should always result in a new state
let bank2 = new_from_parent(&Arc::new(bank1));
let bank1 = Arc::new(bank1);
let bank2 = new_from_parent(&bank1);
assert_ne!(bank0.hash_internal_state(), bank2.hash_internal_state());
let pubkey2 = solana_sdk::pubkey::new_rand();
info!("transfer 2 {}", pubkey2);
bank2.transfer(amount, &mint_keypair, &pubkey2).unwrap();
add_root_and_flush_write_cache(&bank0);
add_root_and_flush_write_cache(&bank1);
add_root_and_flush_write_cache(&bank2);
bank2.update_accounts_hash_for_tests();
assert!(bank2.verify_bank_hash(VerifyBankHash::default_for_test()));
}