Panic when a snapshot fails to verify
This commit is contained in:
parent
da7d94d0f0
commit
4870a2cbac
|
@ -136,6 +136,11 @@ pub fn add_snapshot<P: AsRef<Path>>(snapshot_path: P, bank: &Bank) -> Result<()>
|
|||
bank.slot(),
|
||||
snapshot_file_path,
|
||||
);
|
||||
if !bank.verify_hash_internal_state() {
|
||||
// Sanity check that the new snapshot is valid. If not then there's a bad bug somewhere
|
||||
panic!("Snapshot bank failed to verify");
|
||||
}
|
||||
|
||||
let snapshot_file = File::create(&snapshot_file_path)?;
|
||||
// snapshot writer
|
||||
let mut snapshot_stream = BufWriter::new(snapshot_file);
|
||||
|
@ -194,9 +199,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
|
|||
)?;
|
||||
|
||||
if !bank.verify_hash_internal_state() {
|
||||
warn!("Invalid snapshot hash value!");
|
||||
} else {
|
||||
info!("Snapshot hash value matches.");
|
||||
panic!("Snapshot bank failed to verify");
|
||||
}
|
||||
|
||||
// Move the unpacked snapshots into `snapshot_config.snapshot_path`
|
||||
|
|
Loading…
Reference in New Issue