diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs index 91d8ef9783..f9aada2889 100644 --- a/cli/src/cluster_query.rs +++ b/cli/src/cluster_query.rs @@ -1636,7 +1636,7 @@ pub fn process_show_stakes( CliError::RpcRequestError("Failed to deserialize stake history".to_string()) })?; // At v1.6, this check can be removed and simply passed as `true` - let stake_program_v2_enabled = is_stake_program_v2_enabled(rpc_client); + let stake_program_v2_enabled = is_stake_program_v2_enabled(rpc_client)?; let mut stake_accounts: Vec = vec![]; for (stake_pubkey, stake_account) in all_stake_accounts { diff --git a/cli/src/nonce.rs b/cli/src/nonce.rs index e7ee457b7a..81bf99b448 100644 --- a/cli/src/nonce.rs +++ b/cli/src/nonce.rs @@ -457,11 +457,11 @@ pub fn process_new_nonce( (&nonce_account, "nonce_account_pubkey".to_string()), )?; - let nonce_account_check = rpc_client.get_account(&nonce_account); - if nonce_account_check.is_err() { - return Err(CliError::BadParameter( - "Unable to create new nonce, no nonce account found".to_string(), - ) + if let Err(err) = rpc_client.get_account(&nonce_account) { + return Err(CliError::BadParameter(format!( + "Unable to advance nonce account {}. error: {}", + nonce_account, err + )) .into()); } diff --git a/cli/src/stake.rs b/cli/src/stake.rs index 8bf220c3ff..fdb734ba7b 100644 --- a/cli/src/stake.rs +++ b/cli/src/stake.rs @@ -1718,7 +1718,7 @@ pub fn process_show_stake_account( use_lamports_unit, &stake_history, &clock, - is_stake_program_v2_enabled(rpc_client), // At v1.6, this check can be removed and simply passed as `true` + is_stake_program_v2_enabled(rpc_client)?, // At v1.6, this check can be removed and simply passed as `true` ); if state.stake_type == CliStakeType::Stake { @@ -1787,10 +1787,10 @@ pub fn process_delegate_stake( // voted at the tip of the ledger let vote_account_data = rpc_client .get_account(vote_account_pubkey) - .map_err(|_| { + .map_err(|err| { CliError::RpcRequestError(format!( - "Vote account not found: {}", - vote_account_pubkey + "Vote account not found: {}. error: {}", + vote_account_pubkey, err, )) })? .data; @@ -1878,13 +1878,13 @@ pub fn process_delegate_stake( } } -pub fn is_stake_program_v2_enabled(rpc_client: &RpcClient) -> bool { - rpc_client - .get_account(&feature_set::stake_program_v2::id()) - .ok() - .and_then(|account| feature::from_account(&account)) +pub fn is_stake_program_v2_enabled( + rpc_client: &RpcClient, +) -> Result> { + let feature_account = rpc_client.get_account(&feature_set::stake_program_v2::id())?; + Ok(feature::from_account(&feature_account) .and_then(|feature| feature.activated_at) - .is_some() + .is_some()) } #[cfg(test)]