get_vote_accounts: access HashMap directly instead of turning it into an iterator (#12829)

(cherry picked from commit 649fe6d3b6)

Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
mergify[bot]
2020-10-13 05:25:31 +00:00
committed by GitHub
parent 1986927eb6
commit f0d761630e

View File

@ -548,9 +548,6 @@ impl JsonRpcRequestProcessor {
} else { } else {
0 0
}; };
let epoch_vote_account = epoch_vote_accounts
.iter()
.any(|(epoch_vote_pubkey, _)| epoch_vote_pubkey == pubkey);
RpcVoteAccountInfo { RpcVoteAccountInfo {
vote_pubkey: (pubkey).to_string(), vote_pubkey: (pubkey).to_string(),
node_pubkey: vote_state.node_pubkey.to_string(), node_pubkey: vote_state.node_pubkey.to_string(),
@ -558,7 +555,7 @@ impl JsonRpcRequestProcessor {
commission: vote_state.commission, commission: vote_state.commission,
root_slot: vote_state.root_slot.unwrap_or(0), root_slot: vote_state.root_slot.unwrap_or(0),
epoch_credits: vote_state.epoch_credits().clone(), epoch_credits: vote_state.epoch_credits().clone(),
epoch_vote_account, epoch_vote_account: epoch_vote_accounts.contains_key(pubkey),
last_vote, last_vote,
} }
}) })