--halt-at-slot-store-hash-raw-data works for root bank (#26865)

This commit is contained in:
Jeff Washington (jwash) 2022-08-01 14:25:47 -05:00 committed by GitHub
parent d159682a6d
commit f6e4f76dac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 11 deletions

View File

@ -1533,25 +1533,34 @@ fn load_frozen_forks(
)?;
if slot >= halt_at_slot {
bank.force_flush_accounts_cache();
let can_cached_slot_be_unflushed = true;
// note that this slot may not be a root
let _ = bank.verify_bank_hash(VerifyBankHash {
test_hash_calculation: false,
can_cached_slot_be_unflushed,
ignore_mismatch: true,
require_rooted_bank: false,
run_in_background: false,
store_hash_raw_data_for_debug: on_halt_store_hash_raw_data_for_debug,
});
run_final_hash_calc(&bank, on_halt_store_hash_raw_data_for_debug);
break;
}
}
} else if on_halt_store_hash_raw_data_for_debug {
run_final_hash_calc(
&bank_forks.read().unwrap().root_bank(),
on_halt_store_hash_raw_data_for_debug,
);
}
Ok(())
}
fn run_final_hash_calc(bank: &Bank, on_halt_store_hash_raw_data_for_debug: bool) {
bank.force_flush_accounts_cache();
let can_cached_slot_be_unflushed = true;
// note that this slot may not be a root
let _ = bank.verify_bank_hash(VerifyBankHash {
test_hash_calculation: false,
can_cached_slot_be_unflushed,
ignore_mismatch: true,
require_rooted_bank: false,
run_in_background: false,
store_hash_raw_data_for_debug: on_halt_store_hash_raw_data_for_debug,
});
}
// `roots` is sorted largest to smallest by root slot
fn supermajority_root(roots: &[(Slot, u64)], total_epoch_stake: u64) -> Option<Slot> {
if roots.is_empty() {