From f6e4f76dacce2f261a6ac8964ffbf83c586d7cd0 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Mon, 1 Aug 2022 14:25:47 -0500 Subject: [PATCH] --halt-at-slot-store-hash-raw-data works for root bank (#26865) --- ledger/src/blockstore_processor.rs | 31 +++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index 7ac0e0db2..22b8b872b 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -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 { if roots.is_empty() {