Avoid multiple base58 encodes for all votes when no `voteSubscribe` is disabled

This commit is contained in:
Michael Vines 2022-05-16 15:01:05 -07:00
parent 48982778ef
commit e718c80a21
1 changed files with 6 additions and 6 deletions

View File

@ -804,16 +804,16 @@ impl RpcSubscriptions {
// unlike `NotificationEntry::Gossip`, which also accounts for slots seen
// in VoteState's from bank states built in ReplayStage.
NotificationEntry::Vote((vote_pubkey, ref vote_info)) => {
let rpc_vote = RpcVote {
vote_pubkey: vote_pubkey.to_string(),
slots: vote_info.slots(),
hash: bs58::encode(vote_info.hash()).into_string(),
timestamp: vote_info.timestamp(),
};
if let Some(sub) = subscriptions
.node_progress_watchers()
.get(&SubscriptionParams::Vote)
{
let rpc_vote = RpcVote {
vote_pubkey: vote_pubkey.to_string(),
slots: vote_info.slots(),
hash: bs58::encode(vote_info.hash()).into_string(),
timestamp: vote_info.timestamp(),
};
debug!("vote notify: {:?}", vote_info);
inc_new_counter_info!("rpc-subscription-notify-vote", 1);
notifier.notify(&rpc_vote, sub, false);