From b6b779d2c483e398c60f754428ef6d10198d538e Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 11 May 2020 22:49:09 -0700 Subject: [PATCH] Use CommitmentConfig::root() when checking accounts, CommitmentConfig::max() may not be available yet --- validator/src/main.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/validator/src/main.rs b/validator/src/main.rs index 6a889ca9bb..bcf004594b 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -25,6 +25,7 @@ use solana_ledger::{bank_forks::SnapshotConfig, hardened_unpack::unpack_genesis_ use solana_perf::recycler::enable_recycler_warming; use solana_sdk::{ clock::Slot, + commitment_config::CommitmentConfig, genesis_config::GenesisConfig, hash::Hash, pubkey::Pubkey, @@ -279,8 +280,10 @@ fn check_vote_account( authorized_voter_pubkeys: &[Pubkey], ) -> Result<(), String> { let vote_account = rpc_client - .get_account(vote_account_address) - .map_err(|err| format!("vote account not found: {}", err.to_string()))?; + .get_account_with_commitment(vote_account_address, CommitmentConfig::root()) + .map_err(|err| format!("failed to fetch vote account: {}", err.to_string()))? + .value + .ok_or_else(|| format!("vote account does not exist: {}", vote_account_address))?; if vote_account.owner != solana_vote_program::id() { return Err(format!( @@ -290,8 +293,10 @@ fn check_vote_account( } let identity_account = rpc_client - .get_account(identity_pubkey) - .map_err(|err| format!("Identity account not found: {}", err.to_string()))?; + .get_account_with_commitment(identity_pubkey, CommitmentConfig::root()) + .map_err(|err| format!("failed to fetch identity account: {}", err.to_string()))? + .value + .ok_or_else(|| format!("identity account does not exist: {}", identity_pubkey))?; let vote_state = solana_vote_program::vote_state::VoteState::from(&vote_account); if let Some(vote_state) = vote_state { @@ -1112,7 +1117,7 @@ pub fn main() { }) .and_then(|_| { if let Some(snapshot_hash) = snapshot_hash { - rpc_client.get_slot() + rpc_client.get_slot_with_commitment(CommitmentConfig::root()) .map_err(|err| format!("Failed to get RPC node slot: {}", err)) .and_then(|slot| { info!("RPC node root slot: {}", slot);