From 5a892af2fe309cc775d453fac5f90eee96508d0f Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Wed, 23 Mar 2022 21:03:31 -0500 Subject: [PATCH] disable 'check_hash' on accounts hash calc (#23873) --- runtime/src/accounts_db.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 7889a61d8e..6862cf1177 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -5117,7 +5117,7 @@ impl AccountsDb { &self, slot: Slot, ancestors: &Ancestors, - check_hash: bool, + check_hash: bool, // this will not be supported anymore ) -> Result<(Hash, u64), BankHashVerificationError> { use BankHashVerificationError::*; let mut collect = Measure::start("collect"); @@ -5173,7 +5173,7 @@ impl AccountsDb { |loaded_account| { let loaded_hash = loaded_account.loaded_hash(); let balance = loaded_account.lamports(); - if check_hash && !self.is_filler_account(pubkey) { + if check_hash && !self.is_filler_account(pubkey) { // this will not be supported anymore let computed_hash = loaded_account.compute_hash(*slot, pubkey); if computed_hash != loaded_hash { @@ -5488,7 +5488,7 @@ impl AccountsDb { use_index: bool, slot: Slot, ancestors: &Ancestors, - check_hash: bool, + check_hash: bool, // this will not be supported anymore can_cached_slot_be_unflushed: bool, slots_per_epoch: Option, is_startup: bool, @@ -5663,6 +5663,7 @@ impl AccountsDb { CalculateHashIntermediate::new(loaded_account.loaded_hash(), balance, *pubkey); if check_hash && !Self::is_filler_account_helper(pubkey, filler_account_suffix) { + // this will not be supported anymore let computed_hash = loaded_account.compute_hash(slot, pubkey); if computed_hash != source_item.hash { info!( @@ -5793,7 +5794,7 @@ impl AccountsDb { use BankHashVerificationError::*; let use_index = false; - let check_hash = true; + let check_hash = false; // this will not be supported anymore let is_startup = true; let can_cached_slot_be_unflushed = false; let (calculated_hash, calculated_lamports) = self @@ -10110,7 +10111,7 @@ pub mod tests { db.add_root(some_slot); assert_matches!( db.verify_bank_hash_and_lamports(some_slot, &ancestors, 1, true), - Err(MismatchedAccountHash) + Err(MismatchedBankHash) ); }