Skip to content

Commit

Permalink
Freezes bank in tests (#3427)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Nov 1, 2024
1 parent eb12711 commit c53955e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions runtime/src/bank/accounts_lt_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,11 @@ mod tests {
)
.unwrap();

// Correctly calculating the accounts lt hash in Bank::new_from_fields() depends on the
// bank being frozen. This is so we don't call `update_accounts_lt_hash()` twice on the
// same bank!
assert!(roundtrip_bank.is_frozen());

// Wait for the startup verification to complete. If we don't panic, then we're good!
roundtrip_bank.wait_for_initial_accounts_hash_verification_completed_for_tests();
assert_eq!(roundtrip_bank, *bank);
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/bank/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ mod tests {
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
bank0.squash();
let mut bank = Bank::new_from_parent(bank0.clone(), &Pubkey::default(), 1);

bank.freeze();
add_root_and_flush_write_cache(&bank0);
bank.rc
.accounts
Expand Down Expand Up @@ -470,6 +470,7 @@ mod tests {
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
bank0.squash();
let mut bank = Bank::new_from_parent(bank0.clone(), &Pubkey::default(), 1);
bank.freeze();
add_root_and_flush_write_cache(&bank0);
bank.rc
.accounts
Expand Down

0 comments on commit c53955e

Please sign in to comment.