pub fn batch_verify_aggregated_signature(
        &self,
        hash: HashValue,
        aggregated_signature: &BTreeMap<AccountAddress, Ed25519Signature>,
    ) -> std::result::Result<(), VerifyError> {
        self.check_num_of_signatures(aggregated_signature)?;
        self.check_voting_power(aggregated_signature.keys())?;
        let keys_and_signatures: Vec<(Ed25519PublicKey, Ed25519Signature)> = aggregated_signature
            .iter()
            .flat_map(|(address, signature)| {
                let sig = signature.clone();
                self.get_public_key(&address).map(|pub_key| (pub_key, sig))
            })
            .collect();
        // Fallback is required to identify the source of the problem if batching fails.
        if Ed25519PublicKey::batch_verify_signatures(&hash, keys_and_signatures).is_err() {
            self.verify_aggregated_signature(hash, aggregated_signature)?
        }
        Ok(())
    }
/// This function will try batch signature verification and falls back to normal
/// iterated verification if batching fails.
This function will try batch signature verification and falls back to normal
iterated verification if batching fails.
This function will try batch signature verification and falls back to normal iterated verification if batching fails .
pub fn batch_verify_aggregated_signature(
        &self,
        hash: HashValue,
        aggregated_signature: &BTreeMap<AccountAddress, Ed25519Signature>,
    ) -> std::result::Result<(), VerifyError> {
        self.check_num_of_signatures(aggregated_signature)?;
        self.check_voting_power(aggregated_signature.keys())?;
        let keys_and_signatures: Vec<(Ed25519PublicKey, Ed25519Signature)> = aggregated_signature
            .iter()
            .flat_map(|(address, signature)| {
                let sig = signature.clone();
                self.get_public_key(&address).map(|pub_key| (pub_key, sig))
            })
            .collect();
        // Fallback is required to identify the source of the problem if batching fails.
        if Ed25519PublicKey::batch_verify_signatures(&hash, keys_and_signatures).is_err() {
            self.verify_aggregated_signature(hash, aggregated_signature)?
        }
        Ok(())
    }
pub fn batch_verify_aggregated_signature ( & self , hash : HashValue , aggregated_signature : & BTreeMap < AccountAddress , Ed25519Signature > , ) -> std :: result :: Result < ( ) , VerifyError > { self . check_num_of_signatures ( aggregated_signature ) ? ; self . check_voting_power ( aggregated_signature . keys ( ) ) ? ; let keys_and_signatures : Vec < ( Ed25519PublicKey , Ed25519Signature ) > = aggregated_signature . iter ( ) . flat_map ( | ( address , signature ) | { let sig = signature . clone ( ) ; self . get_public_key ( & address ) . map ( | pub_key | ( pub_key , sig ) ) } ) . collect ( ) ; // Fallback is required to identify the source of the problem if batching fails. if Ed25519PublicKey :: batch_verify_signatures ( & hash , keys_and_signatures ) . is_err ( ) { self . verify_aggregated_signature ( hash , aggregated_signature ) ? } Ok ( ( ) ) }
This function will try batch signature verification and falls back to normal
iterated verification if batching fails.
This function will try batch signature verification and falls back to normal iterated verification if batching fails .
&self
hash
HashValue
aggregated_signature
&BTreeMap<AccountAddress, Ed25519Signature>
&self
hash
HashValue
aggregated_signature
&BTreeMap<AccountAddress, Ed25519Signature>