From 0ccac9b790ddea80aeecbf1732dabe05667f3d4a Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 1 Feb 2021 17:35:16 -0800 Subject: [PATCH] Sanity check that the RPC endpoint is healthy before performing too much work --- stake-o-matic/src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stake-o-matic/src/main.rs b/stake-o-matic/src/main.rs index 1171245c67..7355e2043d 100644 --- a/stake-o-matic/src/main.rs +++ b/stake-o-matic/src/main.rs @@ -646,6 +646,12 @@ fn main() -> Result<(), Box> { 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()?;