fn aggregate_qc(
        &mut self,
        vote: &Vote,
        validator_verifier: &ValidatorVerifier,
    ) -> VoteReceptionResult {
        // Note that the digest covers the ledger info information, which is also indirectly
        // covering vote data hash (in its `consensus_data_hash` field).
        let li_digest = vote.ledger_info().hash();
        let li_with_sig = self.li_digest_to_votes.entry(li_digest).or_insert_with(|| {
            LedgerInfoWithSignatures::new(vote.ledger_info().clone(), BTreeMap::new())
        });
        li_with_sig.add_signature(vote.author(), vote.signature().clone());

        match validator_verifier.check_voting_power(li_with_sig.signatures().keys()) {
            Ok(_) => VoteReceptionResult::NewQuorumCertificate(Arc::new(QuorumCert::new(
                vote.vote_data().clone(),
                li_with_sig.clone(),
            ))),
            Err(VerifyError::TooLittleVotingPower { voting_power, .. }) => {
                VoteReceptionResult::VoteAdded(voting_power)
            }
            Err(error) => {
                error!("MUST_FIX: vote received could not be added: {}", error);
                VoteReceptionResult::ErrorAddingVote(error)
            }
        }
    }
/// Check whether the newly inserted vote completes a QC
Check whether the newly inserted vote completes a QC
Check whether the newly inserted vote completes a QC
fn aggregate_qc(
        &mut self,
        vote: &Vote,
        validator_verifier: &ValidatorVerifier,
    ) -> VoteReceptionResult {
        // Note that the digest covers the ledger info information, which is also indirectly
        // covering vote data hash (in its `consensus_data_hash` field).
        let li_digest = vote.ledger_info().hash();
        let li_with_sig = self.li_digest_to_votes.entry(li_digest).or_insert_with(|| {
            LedgerInfoWithSignatures::new(vote.ledger_info().clone(), BTreeMap::new())
        });
        li_with_sig.add_signature(vote.author(), vote.signature().clone());
        match validator_verifier.check_voting_power(li_with_sig.signatures().keys()) {
            Ok(_) => VoteReceptionResult::NewQuorumCertificate(Arc::new(QuorumCert::new(
                vote.vote_data().clone(),
                li_with_sig.clone(),
            ))),
            Err(VerifyError::TooLittleVotingPower { voting_power, .. }) => {
                VoteReceptionResult::VoteAdded(voting_power)
            }
            Err(error) => {
                error!("MUST_FIX: vote received could not be added: {}", error);
                VoteReceptionResult::ErrorAddingVote(error)
            }
        }
    }
fn aggregate_qc ( & mut self , vote : & Vote , validator_verifier : & ValidatorVerifier , ) -> VoteReceptionResult { // Note that the digest covers the ledger info information, which is also indirectly // covering vote data hash (in its `consensus_data_hash` field). let li_digest = vote . ledger_info ( ) . hash ( ) ; let li_with_sig = self . li_digest_to_votes . entry ( li_digest ) . or_insert_with ( | | { LedgerInfoWithSignatures :: new ( vote . ledger_info ( ) . clone ( ) , BTreeMap :: new ( ) ) } ) ; li_with_sig . add_signature ( vote . author ( ) , vote . signature ( ) . clone ( ) ) ; match validator_verifier . check_voting_power ( li_with_sig . signatures ( ) . keys ( ) ) { Ok ( _ ) => VoteReceptionResult :: NewQuorumCertificate ( Arc :: new ( QuorumCert :: new ( vote . vote_data ( ) . clone ( ) , li_with_sig . clone ( ) , ) ) ) , Err ( VerifyError :: TooLittleVotingPower { voting_power , .. } ) => { VoteReceptionResult :: VoteAdded ( voting_power ) } Err ( error ) => { error ! ( " " error ) ; VoteReceptionResult :: ErrorAddingVote ( error ) } } }
Check whether the newly inserted vote completes a QC
Check whether the newly inserted vote completes a QC
&mut self
vote
&Vote
validator_verifier
&ValidatorVerifier
&mut self
vote
&Vote
validator_verifier
&ValidatorVerifier