ledger-tool: Rename load_frozen_forks() and adjust error messages (#31903)
This function has morphed as it has been updated, and the existing function name is a bit of misnomer. Update the function name to use terminology that I think is more clear and more consistent with what we use core/src/validator.rs. Additionally, adjust the error messages to be more clear about what exactly is wrong for when we can't process.
This commit is contained in:
parent
ecf460c655
commit
1d6b03358f
|
@ -67,7 +67,7 @@ pub fn get_shred_storage_type(ledger_path: &Path, message: &str) -> ShredStorage
|
|||
}
|
||||
}
|
||||
|
||||
pub fn load_bank_forks(
|
||||
pub fn load_and_process_ledger(
|
||||
arg_matches: &ArgMatches,
|
||||
genesis_config: &GenesisConfig,
|
||||
blockstore: Arc<Blockstore>,
|
||||
|
@ -111,6 +111,8 @@ pub fn load_bank_forks(
|
|||
})
|
||||
};
|
||||
|
||||
let start_slot_msg = "The starting slot will be the latest snapshot slot, or genesis if \
|
||||
the --no-snapshot flag is specified or if no snapshots are found.";
|
||||
match process_options.halt_at_slot {
|
||||
// Skip the following checks for sentinel values of Some(0) and None.
|
||||
// For Some(0), no slots will be be replayed after starting_slot.
|
||||
|
@ -119,15 +121,17 @@ pub fn load_bank_forks(
|
|||
Some(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 the --no-snapshot flag is specified or if no snapshots are found."
|
||||
);
|
||||
"Unable to process blockstore from starting slot {starting_slot} to \
|
||||
{halt_slot}; the ending slot is less than the starting slot. {start_slot_msg}"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
// Check if we have the slot data necessary to replay from starting_slot to >= halt_slot.
|
||||
if !blockstore.slot_range_connected(starting_slot, halt_slot) {
|
||||
eprintln!(
|
||||
"Unable to load bank forks at slot {halt_slot} due to disconnected blocks.",
|
||||
"Unable to process blockstore from starting slot {starting_slot} to \
|
||||
{halt_slot}; the blockstore does not contain a replayable chain between these \
|
||||
slots. {start_slot_msg}"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -2201,7 +2201,7 @@ fn main() {
|
|||
wal_recovery_mode,
|
||||
force_update_to_open,
|
||||
);
|
||||
match load_bank_forks(
|
||||
match load_and_process_ledger(
|
||||
arg_matches,
|
||||
&genesis_config,
|
||||
Arc::new(blockstore),
|
||||
|
@ -2293,7 +2293,7 @@ fn main() {
|
|||
wal_recovery_mode,
|
||||
force_update_to_open,
|
||||
);
|
||||
match load_bank_forks(
|
||||
match load_and_process_ledger(
|
||||
arg_matches,
|
||||
&genesis_config,
|
||||
Arc::new(blockstore),
|
||||
|
@ -2531,7 +2531,7 @@ fn main() {
|
|||
wal_recovery_mode,
|
||||
force_update_to_open,
|
||||
);
|
||||
let (bank_forks, ..) = load_bank_forks(
|
||||
let (bank_forks, ..) = load_and_process_ledger(
|
||||
arg_matches,
|
||||
&genesis_config,
|
||||
Arc::new(blockstore),
|
||||
|
@ -2575,7 +2575,7 @@ fn main() {
|
|||
wal_recovery_mode,
|
||||
force_update_to_open,
|
||||
);
|
||||
match load_bank_forks(
|
||||
match load_and_process_ledger(
|
||||
arg_matches,
|
||||
&open_genesis_config_by(&ledger_path, arg_matches),
|
||||
Arc::new(blockstore),
|
||||
|
@ -2745,7 +2745,7 @@ fn main() {
|
|||
output_directory.display()
|
||||
);
|
||||
|
||||
match load_bank_forks(
|
||||
match load_and_process_ledger(
|
||||
arg_matches,
|
||||
&genesis_config,
|
||||
blockstore.clone(),
|
||||
|
@ -3116,7 +3116,7 @@ fn main() {
|
|||
wal_recovery_mode,
|
||||
force_update_to_open,
|
||||
);
|
||||
let (bank_forks, ..) = load_bank_forks(
|
||||
let (bank_forks, ..) = load_and_process_ledger(
|
||||
arg_matches,
|
||||
&genesis_config,
|
||||
Arc::new(blockstore),
|
||||
|
@ -3205,7 +3205,7 @@ fn main() {
|
|||
wal_recovery_mode,
|
||||
force_update_to_open,
|
||||
);
|
||||
match load_bank_forks(
|
||||
match load_and_process_ledger(
|
||||
arg_matches,
|
||||
&genesis_config,
|
||||
Arc::new(blockstore),
|
||||
|
|
|
@ -119,7 +119,7 @@ fn load_blockstore(ledger_path: &Path, arg_matches: &ArgMatches<'_>) -> Arc<Bank
|
|||
wal_recovery_mode,
|
||||
force_update_to_open,
|
||||
);
|
||||
let (bank_forks, ..) = load_bank_forks(
|
||||
let (bank_forks, ..) = load_and_process_ledger(
|
||||
arg_matches,
|
||||
&genesis_config,
|
||||
Arc::new(blockstore),
|
||||
|
|
Loading…
Reference in New Issue