verify bank hash on startup with ledger tool option (#17939)

This commit is contained in:
Jeff Washington (jwash)
2021-06-15 11:52:12 -05:00
committed by GitHub
parent 1b1d34da59
commit f558b9b6bf
7 changed files with 59 additions and 39 deletions

View File

@@ -613,6 +613,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
accounts_db_caching_enabled: bool,
limit_load_slot_count_from_snapshot: Option<usize>,
shrink_ratio: AccountShrinkThreshold,
test_hash_calculation: bool,
) -> Result<(Bank, BankFromArchiveTimings)> {
let unpack_dir = tempfile::Builder::new()
.prefix(TMP_SNAPSHOT_PREFIX)
@@ -651,7 +652,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
measure.stop();
let mut verify = Measure::start("verify");
if !bank.verify_snapshot_bank() {
if !bank.verify_snapshot_bank(test_hash_calculation) {
panic!("Snapshot bank for slot {} failed to verify", bank.slot());
}
verify.stop();