pub async fn process_vote(&mut self, vote_msg: VoteMsg) {
        trace_code_block!("round_manager::process_vote", {"block", vote_msg.proposed_block_id()});
        // Check whether this validator is a valid recipient of the vote.
        if !vote_msg.vote().is_timeout() {
            // Unlike timeout votes regular votes are sent to the leaders of the next round only.
            let next_round = vote_msg.vote().vote_data().proposed().round() + 1;
            if self
                .proposer_election
                .is_valid_proposer(self.proposal_generator.author(), next_round)
                .is_none()
            {
                debug!(
                    "Received {}, but I am not a valid proposer for round {}, ignore.",
                    vote_msg, next_round
                );
                security_log(SecurityEvent::InvalidConsensusVote)
                    .error("InvalidProposer")
                    .data(vote_msg)
                    .data(next_round)
                    .log();
                return;
            }
        }
        if self
            .sync_up(vote_msg.sync_info(), vote_msg.vote().author(), true)
            .await
            .is_err()
        {
            warn!("Stop vote processing because of sync up error.");
            return;
        };
        if let Err(e) = self.add_vote(vote_msg.vote()).await {
            error!("Error adding a new vote: {:?}", e);
        }
    }
/// Upon new vote:
/// 1. Filter out votes for rounds that should not be processed by this validator (to avoid
/// potential attacks).
/// 2. Add the vote to the store and check whether it finishes a QC.
/// 3. Once the QC successfully formed, notify the RoundState.
Upon new vote:
1. Filter out votes for rounds that should not be processed by this validator (to avoid
potential attacks).
2. Add the vote to the store and check whether it finishes a QC.
3. Once the QC successfully formed, notify the RoundState.
Upon new vote : 1 . Filter out votes for rounds that should not be processed by this validator ( to avoid potential attacks ) . 2 . Add the vote to the store and check whether it finishes a QC . 3 . Once the QC successfully formed notify the RoundState .
pub async fn process_vote(&mut self, vote_msg: VoteMsg) {
        trace_code_block!("round_manager::process_vote", {"block", vote_msg.proposed_block_id()});
        // Check whether this validator is a valid recipient of the vote.
        if !vote_msg.vote().is_timeout() {
            // Unlike timeout votes regular votes are sent to the leaders of the next round only.
            let next_round = vote_msg.vote().vote_data().proposed().round() + 1;
            if self
                .proposer_election
                .is_valid_proposer(self.proposal_generator.author(), next_round)
                .is_none()
            {
                debug!(
                    "Received {}, but I am not a valid proposer for round {}, ignore.",
                    vote_msg, next_round
                );
                security_log(SecurityEvent::InvalidConsensusVote)
                    .error("InvalidProposer")
                    .data(vote_msg)
                    .data(next_round)
                    .log();
                return;
            }
        }
        if self
            .sync_up(vote_msg.sync_info(), vote_msg.vote().author(), true)
            .await
            .is_err()
        {
            warn!("Stop vote processing because of sync up error.");
            return;
        };
        if let Err(e) = self.add_vote(vote_msg.vote()).await {
            error!("Error adding a new vote: {:?}", e);
        }
    }
pub async fn process_vote ( & mut self , vote_msg : VoteMsg ) { trace_code_block ! ( " " { " " vote_msg proposed_block_id ( ) } ) ; // Check whether this validator is a valid recipient of the vote. if ! vote_msg . vote ( ) . is_timeout ( ) { // Unlike timeout votes regular votes are sent to the leaders of the next round only. let next_round = vote_msg . vote ( ) . vote_data ( ) . proposed ( ) . round ( ) + 1 ; if self . proposer_election . is_valid_proposer ( self . proposal_generator . author ( ) , next_round ) . is_none ( ) { debug ! ( " " vote_msg next_round ) ; security_log ( SecurityEvent :: InvalidConsensusVote ) . error ( " " ) . data ( vote_msg ) . data ( next_round ) . log ( ) ; return ; } } if self . sync_up ( vote_msg . sync_info ( ) , vote_msg . vote ( ) . author ( ) , true ) . await . is_err ( ) { warn ! ( " " ) ; return ; } ; if let Err ( e ) = self . add_vote ( vote_msg . vote ( ) ) . await { error ! ( " " e ) ; } }
Upon new vote:
1.
Upon new vote : 1 .
&mut self
vote_msg
VoteMsg
&mut self
vote_msg
VoteMsg