Check that halt_slot >= starting_slot (#29868)

* Check that halt_slot >= starting_slot

* Improve message by saying where starting slot comes from
This commit is contained in:
apfitzge 2023-01-24 14:38:52 -08:00 committed by GitHub
parent 624f3d2d8c
commit 834b98aac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -1066,7 +1066,14 @@ fn load_bank_forks(
};
if let Some(halt_slot) = process_options.halt_at_slot {
// Check if we have the slot data necessary to replay from starting_slot to >= halt_slot.
if halt_slot < starting_slot {
eprintln!(
"Unable to load bank forks at slot {halt_slot} because it is less than the starting slot {starting_slot}. \
The starting slot will be the latest snapshot slot, or genesis if --no-snapshot flag specified or no snapshots found."
);
exit(1);
}
// Check if we have the slot data necessary to replay from starting_slot to <= halt_slot.
// - This will not catch the case when loading from genesis without a full slot 0.
if !blockstore.slot_range_connected(starting_slot, halt_slot) {
eprintln!("Unable to load bank forks at slot {halt_slot} due to disconnected blocks.",);