Return error if stake history deser fails in cli (#6559)

This commit is contained in:
Justin Starry 2019-10-25 16:44:09 -05:00 committed by GitHub
parent 0d1f463f7f
commit 0cfa3d3de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -597,7 +597,9 @@ pub fn process_show_stake_history(
use_lamports_unit: bool,
) -> ProcessResult {
let stake_history_account = rpc_client.get_account(&stake_history::id())?;
let stake_history = StakeHistory::from_account(&stake_history_account).unwrap();
let stake_history = StakeHistory::from_account(&stake_history_account).ok_or_else(|| {
CliError::RpcRequestError("Failed to deserialize stake history".to_string())
})?;
println!();
println!(