remove 'check_hash' from accounts hash calc (backport #23873) (backport #23902) (#24191)

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

(cherry picked from commit 5a892af2fe)

Co-authored-by: Jeff Washington (jwash) <wash678@gmail.com>
(cherry picked from commit f0c5962817)

# Conflicts:
#	runtime/src/accounts_db.rs

* resolve conflicts

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jeff Washington (jwash) <wash678@gmail.com>
This commit is contained in:
mergify[bot]
2022-04-08 15:44:33 -05:00
committed by GitHub
parent 7615585464
commit a225421737

View File

@ -5091,7 +5091,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");
@ -5149,7 +5149,7 @@ impl AccountsDb {
|loaded_account| {
let loaded_hash = loaded_account.loaded_hash();
let balance = account_info.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 {
@ -5466,7 +5466,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<Slot>,
is_startup: bool,
@ -5645,6 +5645,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!(
@ -5783,7 +5784,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
@ -10045,7 +10046,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)
);
}