Panic when a snapshot fails to verify
This commit is contained in:
@ -136,6 +136,11 @@ pub fn add_snapshot<P: AsRef<Path>>(snapshot_path: P, bank: &Bank) -> Result<()>
|
|||||||
bank.slot(),
|
bank.slot(),
|
||||||
snapshot_file_path,
|
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)?;
|
let snapshot_file = File::create(&snapshot_file_path)?;
|
||||||
// snapshot writer
|
// snapshot writer
|
||||||
let mut snapshot_stream = BufWriter::new(snapshot_file);
|
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() {
|
if !bank.verify_hash_internal_state() {
|
||||||
warn!("Invalid snapshot hash value!");
|
panic!("Snapshot bank failed to verify");
|
||||||
} else {
|
|
||||||
info!("Snapshot hash value matches.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the unpacked snapshots into `snapshot_config.snapshot_path`
|
// Move the unpacked snapshots into `snapshot_config.snapshot_path`
|
||||||
|
Reference in New Issue
Block a user