stop logging misleading bank hash mismatch (#25427)
This commit is contained in:
parent
3608801a54
commit
41f30a2383
|
@ -1346,7 +1346,7 @@ fn load_frozen_forks(
|
|||
if slot >= halt_at_slot {
|
||||
bank.force_flush_accounts_cache();
|
||||
let can_cached_slot_be_unflushed = true;
|
||||
let _ = bank.verify_bank_hash(false, can_cached_slot_be_unflushed);
|
||||
let _ = bank.verify_bank_hash(false, can_cached_slot_be_unflushed, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,8 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
|
|||
test_hash_calculation,
|
||||
&EpochSchedule::default(),
|
||||
&RentCollector::default(),
|
||||
false
|
||||
false,
|
||||
false,
|
||||
))
|
||||
});
|
||||
}
|
||||
|
|
|
@ -796,6 +796,7 @@ impl Accounts {
|
|||
epoch_schedule: &EpochSchedule,
|
||||
rent_collector: &RentCollector,
|
||||
can_cached_slot_be_unflushed: bool,
|
||||
ignore_mismatch: bool,
|
||||
) -> bool {
|
||||
if let Err(err) = self.accounts_db.verify_bank_hash_and_lamports_new(
|
||||
slot,
|
||||
|
@ -805,6 +806,7 @@ impl Accounts {
|
|||
epoch_schedule,
|
||||
rent_collector,
|
||||
can_cached_slot_be_unflushed,
|
||||
ignore_mismatch,
|
||||
) {
|
||||
warn!("verify_bank_hash failed: {:?}", err);
|
||||
false
|
||||
|
|
|
@ -6372,6 +6372,7 @@ impl AccountsDb {
|
|||
epoch_schedule,
|
||||
rent_collector,
|
||||
can_cached_slot_be_unflushed,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -6385,6 +6386,7 @@ impl AccountsDb {
|
|||
epoch_schedule: &EpochSchedule,
|
||||
rent_collector: &RentCollector,
|
||||
can_cached_slot_be_unflushed: bool,
|
||||
ignore_mismatch: bool,
|
||||
) -> Result<(), BankHashVerificationError> {
|
||||
use BankHashVerificationError::*;
|
||||
|
||||
|
@ -6415,6 +6417,9 @@ impl AccountsDb {
|
|||
return Err(MismatchedTotalLamports(calculated_lamports, total_lamports));
|
||||
}
|
||||
|
||||
if ignore_mismatch {
|
||||
Ok(())
|
||||
} else {
|
||||
let bank_hashes = self.bank_hashes.read().unwrap();
|
||||
if let Some(found_hash_info) = bank_hashes.get(&slot) {
|
||||
if calculated_hash == found_hash_info.snapshot_hash {
|
||||
|
@ -6430,6 +6435,7 @@ impl AccountsDb {
|
|||
Err(MissingBankHash)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Perform the scan for pubkeys that were written to in a slot
|
||||
fn do_scan_slot_for_dirty_pubkeys(
|
||||
|
|
|
@ -6330,6 +6330,7 @@ impl Bank {
|
|||
&self,
|
||||
test_hash_calculation: bool,
|
||||
can_cached_slot_be_unflushed: bool,
|
||||
ignore_mismatch: bool,
|
||||
) -> bool {
|
||||
self.rc.accounts.verify_bank_hash_and_lamports(
|
||||
self.slot(),
|
||||
|
@ -6339,6 +6340,7 @@ impl Bank {
|
|||
self.epoch_schedule(),
|
||||
&self.rent_collector,
|
||||
can_cached_slot_be_unflushed,
|
||||
ignore_mismatch,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -6540,7 +6542,7 @@ impl Bank {
|
|||
let (mut verify, verify_time_us) = if !self.rc.accounts.accounts_db.skip_initial_hash_calc {
|
||||
info!("verify_bank_hash..");
|
||||
let mut verify_time = Measure::start("verify_bank_hash");
|
||||
let verify = self.verify_bank_hash(test_hash_calculation, false);
|
||||
let verify = self.verify_bank_hash(test_hash_calculation, false, false);
|
||||
verify_time.stop();
|
||||
(verify, verify_time.as_us())
|
||||
} else {
|
||||
|
@ -9641,17 +9643,17 @@ pub(crate) mod tests {
|
|||
assert_eq!(bank0.get_account(&keypair.pubkey()).unwrap().lamports(), 10);
|
||||
assert_eq!(bank1.get_account(&keypair.pubkey()), None);
|
||||
|
||||
assert!(bank0.verify_bank_hash(true, false));
|
||||
assert!(bank0.verify_bank_hash(true, false, false));
|
||||
|
||||
// Squash and then verify hash_internal value
|
||||
bank0.freeze();
|
||||
bank0.squash();
|
||||
assert!(bank0.verify_bank_hash(true, false));
|
||||
assert!(bank0.verify_bank_hash(true, false, false));
|
||||
|
||||
bank1.freeze();
|
||||
bank1.squash();
|
||||
bank1.update_accounts_hash();
|
||||
assert!(bank1.verify_bank_hash(true, false));
|
||||
assert!(bank1.verify_bank_hash(true, false, false));
|
||||
|
||||
// keypair should have 0 tokens on both forks
|
||||
assert_eq!(bank0.get_account(&keypair.pubkey()), None);
|
||||
|
@ -9659,7 +9661,7 @@ pub(crate) mod tests {
|
|||
bank1.force_flush_accounts_cache();
|
||||
bank1.clean_accounts(false, false, None);
|
||||
|
||||
assert!(bank1.verify_bank_hash(true, false));
|
||||
assert!(bank1.verify_bank_hash(true, false, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -10721,7 +10723,7 @@ pub(crate) mod tests {
|
|||
info!("transfer 2 {}", pubkey2);
|
||||
bank2.transfer(10, &mint_keypair, &pubkey2).unwrap();
|
||||
bank2.update_accounts_hash();
|
||||
assert!(bank2.verify_bank_hash(true, false));
|
||||
assert!(bank2.verify_bank_hash(true, false, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -10745,19 +10747,19 @@ pub(crate) mod tests {
|
|||
// Checkpointing should never modify the checkpoint's state once frozen
|
||||
let bank0_state = bank0.hash_internal_state();
|
||||
bank2.update_accounts_hash();
|
||||
assert!(bank2.verify_bank_hash(true, false));
|
||||
assert!(bank2.verify_bank_hash(true, false, false));
|
||||
let bank3 = Bank::new_from_parent(&bank0, &solana_sdk::pubkey::new_rand(), 2);
|
||||
assert_eq!(bank0_state, bank0.hash_internal_state());
|
||||
assert!(bank2.verify_bank_hash(true, false));
|
||||
assert!(bank2.verify_bank_hash(true, false, false));
|
||||
bank3.update_accounts_hash();
|
||||
assert!(bank3.verify_bank_hash(true, false));
|
||||
assert!(bank3.verify_bank_hash(true, false, false));
|
||||
|
||||
let pubkey2 = solana_sdk::pubkey::new_rand();
|
||||
info!("transfer 2 {}", pubkey2);
|
||||
bank2.transfer(10, &mint_keypair, &pubkey2).unwrap();
|
||||
bank2.update_accounts_hash();
|
||||
assert!(bank2.verify_bank_hash(true, false));
|
||||
assert!(bank3.verify_bank_hash(true, false));
|
||||
assert!(bank2.verify_bank_hash(true, false, false));
|
||||
assert!(bank3.verify_bank_hash(true, false, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in New Issue