Revert ledger-tool changes, fix master (#30763)
Revert 10f49d4
for ledger-tool
This commit is contained in:
parent
f1cd64f4a1
commit
20223b2557
|
@ -102,7 +102,7 @@ use {
|
|||
fs::File,
|
||||
io::{self, stdout, BufRead, BufReader, Write},
|
||||
path::{Path, PathBuf},
|
||||
process::{Command, Stdio},
|
||||
process::{exit, Command, Stdio},
|
||||
str::FromStr,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
|
@ -312,7 +312,7 @@ fn output_ledger(
|
|||
.slot_meta_iterator(starting_slot)
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("Failed to load entries starting from slot {starting_slot}: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
|
||||
if method == LedgerOutputMethod::Json {
|
||||
|
@ -929,7 +929,7 @@ fn open_blockstore(
|
|||
error!("Blockstore is incompatible with current software and requires updates");
|
||||
if !force_update_to_open {
|
||||
error!("Use --force-update-to-open to allow blockstore to update");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
open_blockstore_with_temporary_primary_access(
|
||||
ledger_path,
|
||||
|
@ -941,12 +941,12 @@ fn open_blockstore(
|
|||
"Failed to open blockstore (with --force-update-to-open) at {:?}: {:?}",
|
||||
ledger_path, err
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
})
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("Failed to open blockstore at {ledger_path:?}: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1128,14 +1128,14 @@ fn load_bank_forks(
|
|||
"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."
|
||||
);
|
||||
std::process::exit(1);
|
||||
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.",
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1164,7 +1164,7 @@ fn load_bank_forks(
|
|||
{
|
||||
// Couldn't get Primary access, error out to be defensive.
|
||||
eprintln!("Error: custom accounts path is not supported under secondary access");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
account_paths.split(',').map(PathBuf::from).collect()
|
||||
|
@ -1187,7 +1187,7 @@ fn load_bank_forks(
|
|||
Ok((account_run_path, _account_snapshot_path)) => account_run_path,
|
||||
Err(err) => {
|
||||
eprintln!("Unable to create account run and snapshot sub directories: {}, err: {err:?}", account_path.display());
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}).collect();
|
||||
|
@ -1207,7 +1207,6 @@ fn load_bank_forks(
|
|||
|
||||
let mut accounts_update_notifier = Option::<AccountsUpdateNotifier>::default();
|
||||
let mut transaction_notifier = Option::<TransactionNotifierLock>::default();
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
if arg_matches.is_present("geyser_plugin_config") {
|
||||
let geyser_config_files = values_t_or_exit!(arg_matches, "geyser_plugin_config", String)
|
||||
.into_iter()
|
||||
|
@ -1216,12 +1215,11 @@ fn load_bank_forks(
|
|||
|
||||
let (confirmed_bank_sender, confirmed_bank_receiver) = unbounded();
|
||||
drop(confirmed_bank_sender);
|
||||
|
||||
let geyser_service =
|
||||
GeyserPluginService::new(confirmed_bank_receiver, &geyser_config_files).unwrap_or_else(
|
||||
|err| {
|
||||
eprintln!("Failed to setup Geyser service: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
},
|
||||
);
|
||||
accounts_update_notifier = geyser_service.get_accounts_update_notifier();
|
||||
|
@ -1259,6 +1257,7 @@ fn load_bank_forks(
|
|||
snapshot_request_handler,
|
||||
pruned_banks_request_handler,
|
||||
};
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let accounts_background_service = AccountsBackgroundService::new(
|
||||
bank_forks.clone(),
|
||||
&exit,
|
||||
|
@ -2515,7 +2514,7 @@ fn main() {
|
|||
)
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("Failed to write genesis config: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
|
||||
println!("{}", open_genesis_config_by(&output_directory, arg_matches));
|
||||
|
@ -2561,7 +2560,7 @@ fn main() {
|
|||
}
|
||||
Err(err) => {
|
||||
eprintln!("Failed to load ledger: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2638,7 +2637,7 @@ fn main() {
|
|||
}
|
||||
Err(err) => {
|
||||
eprintln!("Failed to load ledger: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2870,7 +2869,7 @@ fn main() {
|
|||
)
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("Ledger verification failed: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
if print_accounts_stats {
|
||||
let working_bank = bank_forks.read().unwrap().working_bank();
|
||||
|
@ -2931,7 +2930,7 @@ fn main() {
|
|||
}
|
||||
Err(err) => {
|
||||
eprintln!("Failed to load ledger: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2974,7 +2973,7 @@ fn main() {
|
|||
"Error: insufficient --bootstrap-validator-stake-lamports. \
|
||||
Minimum amount is {minimum_stake_lamports}"
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
let bootstrap_validator_pubkeys = pubkeys_of(arg_matches, "bootstrap_validator");
|
||||
let accounts_to_remove =
|
||||
|
@ -2991,7 +2990,7 @@ fn main() {
|
|||
|s| {
|
||||
s.parse::<SnapshotVersion>().unwrap_or_else(|e| {
|
||||
eprintln!("Error: {e}");
|
||||
std::process::exit(1)
|
||||
exit(1)
|
||||
})
|
||||
},
|
||||
);
|
||||
|
@ -3038,7 +3037,7 @@ fn main() {
|
|||
eprintln!(
|
||||
"Error: snapshot slot {snapshot_slot} does not exist in blockstore or is not full.",
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
let ending_slot = if is_minimized {
|
||||
|
@ -3047,7 +3046,7 @@ fn main() {
|
|||
eprintln!(
|
||||
"Error: ending_slot ({ending_slot}) must be greater than snapshot_slot ({snapshot_slot})"
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Some(ending_slot)
|
||||
|
@ -3092,7 +3091,7 @@ fn main() {
|
|||
.get(snapshot_slot)
|
||||
.unwrap_or_else(|| {
|
||||
eprintln!("Error: Slot {snapshot_slot} is not available");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
|
||||
let child_bank_required = rent_burn_percentage.is_ok()
|
||||
|
@ -3147,7 +3146,7 @@ fn main() {
|
|||
eprintln!(
|
||||
"Error: Account does not exist, unable to remove it: {address}"
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
|
||||
account.set_lamports(0);
|
||||
|
@ -3215,7 +3214,7 @@ fn main() {
|
|||
eprintln!(
|
||||
"Error: --bootstrap-validator pubkeys cannot be duplicated"
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3289,7 +3288,7 @@ fn main() {
|
|||
eprintln!(
|
||||
"Error: --warp-slot too close. Must be >= {minimum_warp_slot}"
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
warn!("Warping to slot {}", minimum_warp_slot);
|
||||
|
@ -3339,7 +3338,7 @@ fn main() {
|
|||
if is_incremental {
|
||||
if starting_snapshot_hashes.is_none() {
|
||||
eprintln!("Unable to create incremental snapshot without a base full snapshot");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
let full_snapshot_slot = starting_snapshot_hashes.unwrap().full.hash.0;
|
||||
if bank.slot() <= full_snapshot_slot {
|
||||
|
@ -3348,7 +3347,7 @@ fn main() {
|
|||
bank.slot(),
|
||||
full_snapshot_slot,
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
let incremental_snapshot_archive_info =
|
||||
|
@ -3365,7 +3364,7 @@ fn main() {
|
|||
)
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("Unable to create incremental snapshot: {err}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
|
||||
println!(
|
||||
|
@ -3389,7 +3388,7 @@ fn main() {
|
|||
)
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("Unable to create snapshot: {err}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
|
||||
println!(
|
||||
|
@ -3420,7 +3419,7 @@ fn main() {
|
|||
}
|
||||
Err(err) => {
|
||||
eprintln!("Failed to load ledger: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3450,7 +3449,7 @@ fn main() {
|
|||
)
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("Failed to load ledger: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
|
||||
let bank = bank_forks.read().unwrap().working_bank();
|
||||
|
@ -3541,7 +3540,7 @@ fn main() {
|
|||
let slot = bank_forks.working_bank().slot();
|
||||
let bank = bank_forks.get(slot).unwrap_or_else(|| {
|
||||
eprintln!("Error: Slot {slot} is not available");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
|
||||
if arg_matches.is_present("recalculate_capitalization") {
|
||||
|
@ -3572,7 +3571,7 @@ fn main() {
|
|||
base_bank.epoch(),
|
||||
warp_epoch
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if let Ok(raw_inflation) = value_t!(arg_matches, "inflation", String) {
|
||||
|
@ -4038,7 +4037,7 @@ fn main() {
|
|||
}
|
||||
Err(err) => {
|
||||
eprintln!("Failed to load ledger: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4067,20 +4066,20 @@ fn main() {
|
|||
let slots: Vec<_> = metas.map(|(slot, _)| slot).collect();
|
||||
if slots.is_empty() {
|
||||
eprintln!("Purge range is empty");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
*slots.last().unwrap()
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("Unable to read the Ledger: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if end_slot < start_slot {
|
||||
eprintln!("end slot {end_slot} is less than start slot {start_slot}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
info!(
|
||||
"Purging data from slots {} to {} ({} slots) (skip compaction: {}) (dead slot only: {})",
|
||||
|
@ -4229,7 +4228,7 @@ fn main() {
|
|||
Either adjust `--until` value, or pass a larger `--repair-limit` \
|
||||
to override the limit",
|
||||
);
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
let ancestor_iterator = AncestorIterator::new(start_root, &blockstore)
|
||||
.take_while(|&slot| slot >= end_root);
|
||||
|
@ -4244,7 +4243,7 @@ fn main() {
|
|||
.set_roots(roots_to_fix.iter())
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("Unable to set roots {roots_to_fix:?}: {err}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -4318,7 +4317,7 @@ fn main() {
|
|||
}
|
||||
Err(err) => {
|
||||
eprintln!("Unable to read the Ledger: {err:?}");
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -4370,7 +4369,7 @@ fn main() {
|
|||
}
|
||||
("", _) => {
|
||||
eprintln!("{}", matches.usage());
|
||||
std::process::exit(1);
|
||||
exit(1);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue