From f0d761630ec980c56d08c99cf8f9e269bd44b9cd Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2020 05:25:31 +0000 Subject: [PATCH] get_vote_accounts: access HashMap directly instead of turning it into an iterator (#12829) (cherry picked from commit 649fe6d3b6b04825780b16d702029545157fb3fb) Co-authored-by: Michael Vines --- core/src/rpc.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/rpc.rs b/core/src/rpc.rs index 6edd1753b4..654e03fae2 100644 --- a/core/src/rpc.rs +++ b/core/src/rpc.rs @@ -548,9 +548,6 @@ impl JsonRpcRequestProcessor { } else { 0 }; - let epoch_vote_account = epoch_vote_accounts - .iter() - .any(|(epoch_vote_pubkey, _)| epoch_vote_pubkey == pubkey); RpcVoteAccountInfo { vote_pubkey: (pubkey).to_string(), node_pubkey: vote_state.node_pubkey.to_string(), @@ -558,7 +555,7 @@ impl JsonRpcRequestProcessor { commission: vote_state.commission, root_slot: vote_state.root_slot.unwrap_or(0), epoch_credits: vote_state.epoch_credits().clone(), - epoch_vote_account, + epoch_vote_account: epoch_vote_accounts.contains_key(pubkey), last_vote, } })