Sanity check that the RPC endpoint is healthy before performing too much work

This commit is contained in:
Michael Vines 2021-02-01 17:35:16 -08:00
parent 8e0fdff17c
commit 0ccac9b790
1 changed files with 6 additions and 0 deletions

View File

@ -646,6 +646,12 @@ fn main() -> Result<(), Box<dyn error::Error>> {
process::exit(1);
}
// Sanity check that the RPC endpoint is healthy before performing too much work
rpc_client.get_health().unwrap_or_else(|err| {
error!("RPC endpoint is unhealthy: {:?}", err);
process::exit(1);
});
let source_stake_balance = validate_source_stake_account(&rpc_client, &config)?;
let epoch_info = rpc_client.get_epoch_info()?;