disable 'check_hash' on accounts hash calc (#23873) (#23902)

(cherry picked from commit 5a892af2fe)

Co-authored-by: Jeff Washington (jwash) <wash678@gmail.com>
This commit is contained in:
mergify[bot]
2022-03-24 18:33:50 +00:00
committed by GitHub
parent 1b930a1485
commit f0c5962817

View File

@ -5136,7 +5136,7 @@ impl AccountsDb {
&self, &self,
slot: Slot, slot: Slot,
ancestors: &Ancestors, ancestors: &Ancestors,
check_hash: bool, check_hash: bool, // this will not be supported anymore
) -> Result<(Hash, u64), BankHashVerificationError> { ) -> Result<(Hash, u64), BankHashVerificationError> {
use BankHashVerificationError::*; use BankHashVerificationError::*;
let mut collect = Measure::start("collect"); let mut collect = Measure::start("collect");
@ -5192,7 +5192,7 @@ impl AccountsDb {
|loaded_account| { |loaded_account| {
let loaded_hash = loaded_account.loaded_hash(); let loaded_hash = loaded_account.loaded_hash();
let balance = loaded_account.lamports(); 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 = let computed_hash =
loaded_account.compute_hash(*slot, pubkey); loaded_account.compute_hash(*slot, pubkey);
if computed_hash != loaded_hash { if computed_hash != loaded_hash {
@ -5507,7 +5507,7 @@ impl AccountsDb {
use_index: bool, use_index: bool,
slot: Slot, slot: Slot,
ancestors: &Ancestors, ancestors: &Ancestors,
check_hash: bool, check_hash: bool, // this will not be supported anymore
can_cached_slot_be_unflushed: bool, can_cached_slot_be_unflushed: bool,
slots_per_epoch: Option<Slot>, slots_per_epoch: Option<Slot>,
is_startup: bool, is_startup: bool,
@ -5687,6 +5687,7 @@ impl AccountsDb {
CalculateHashIntermediate::new(loaded_account.loaded_hash(), balance, *pubkey); CalculateHashIntermediate::new(loaded_account.loaded_hash(), balance, *pubkey);
if check_hash && !Self::is_filler_account_helper(pubkey, filler_account_suffix) { 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); let computed_hash = loaded_account.compute_hash(slot, pubkey);
if computed_hash != source_item.hash { if computed_hash != source_item.hash {
info!( info!(
@ -5825,7 +5826,7 @@ impl AccountsDb {
use BankHashVerificationError::*; use BankHashVerificationError::*;
let use_index = false; let use_index = false;
let check_hash = true; let check_hash = false; // this will not be supported anymore
let is_startup = true; let is_startup = true;
let can_cached_slot_be_unflushed = false; let can_cached_slot_be_unflushed = false;
let (calculated_hash, calculated_lamports) = self let (calculated_hash, calculated_lamports) = self
@ -10136,7 +10137,7 @@ pub mod tests {
db.add_root(some_slot); db.add_root(some_slot);
assert_matches!( assert_matches!(
db.verify_bank_hash_and_lamports(some_slot, &ancestors, 1, true), db.verify_bank_hash_and_lamports(some_slot, &ancestors, 1, true),
Err(MismatchedAccountHash) Err(MismatchedBankHash)
); );
} }