From 834b98aac0c0c3ff5d5c99152b42bf0485f084e8 Mon Sep 17 00:00:00 2001 From: apfitzge Date: Tue, 24 Jan 2023 14:38:52 -0800 Subject: [PATCH] Check that halt_slot >= starting_slot (#29868) * Check that halt_slot >= starting_slot * Improve message by saying where starting slot comes from --- ledger-tool/src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 5e7a3eb6f..7ed13e9da 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -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.",);