From 0a878cf52898eb1d68387a51669d013e110ccb1b Mon Sep 17 00:00:00 2001 From: Emil Kuban <64525925+kubanemil@users.noreply.github.com> Date: Thu, 1 Aug 2024 05:08:05 +0500 Subject: [PATCH] comment for if statement Co-authored-by: steviez --- core/src/verified_vote_packets.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/verified_vote_packets.rs b/core/src/verified_vote_packets.rs index b87e1fabfbd125..0840c57b809d22 100644 --- a/core/src/verified_vote_packets.rs +++ b/core/src/verified_vote_packets.rs @@ -213,6 +213,9 @@ impl VerifiedVotePackets { let vote_packets = vote_packets_receiver.recv_timeout(RECV_TIMEOUT)?; let vote_packets = std::iter::once(vote_packets).chain(vote_packets_receiver.try_iter()); + // No need to process any votes if we will not be the leader soon. But, + // return early only after draining the channel to avoid accumulating + // votes that will be stale by the time we do become leader if !would_be_leader { return Ok(()); }