/// Combines signature shares (i.e. evaluates the signature at `x=0`).
///
/// Note: The threshold signatories are indexed from `0` to `num_signatories-1`.
/// The index of each signatory defines the x-value at which the the signature
/// is computed, so is needed along with the signature for the signature to be
/// useful.  Signatures are given in the same order as the signatories.  Missing
/// signatures are represented by `None`.
///
/// # Errors
/// * `CryptoError::InvalidArgument` if the given signature shares are lower
///   than the given threshold.
Combines signature shares .
Note: The threshold signatories are indexed from `0` to `num_signatories-1`.
The index of each signatory defines the x-value at which the the signature
is computed, so is needed along with the signature for the signature to be
useful.  Signatures are given in the same order as the signatories.  Missing
signatures are represented by `None`.
Combines signature shares . Note : The threshold signatories are indexed from ` 0 ` to ` num_signatories - 1 ` . The index of each signatory defines the x - value at which the the signature is computed so is needed along with the signature for the signature to be useful . Signatures are given in the same order as the signatories . Missing signatures are represented by ` None ` .
pub fn combine_signatures(
    signatures: &[Option<Signature>],
    threshold: NumberOfNodes,
) -> CryptoResult<Signature> {
    if threshold.get() as usize > signatures.iter().filter(|s| s.is_some()).count() {
        return Err(CryptoError::InvalidArgument {
            message: format!(
                "Threshold too high: (threshold={} !<= {}=num_shares)",
                threshold.get(),
                signatures.iter().filter(|s| s.is_some()).count()
            ),
        });
    }
    if signatures.is_empty() {
        return Ok(Signature::identity());
    }
    let signatures: Vec<(Scalar, Signature)> = signatures
        .iter()
        .zip(0_u32..)
        .filter_map(|(signature, index)| signature.map(|signature| (x_for_index(index), signature)))
        .collect();
    Ok(PublicCoefficients::interpolate_g1(&signatures).expect("Duplicate indices"))
}
pub fn combine_signatures ( signatures : & [ Option < Signature > ] , threshold : NumberOfNodes , ) -> CryptoResult < Signature > { if threshold . get ( ) as usize > signatures . iter ( ) . filter ( | s | s . is_some ( ) ) . count ( ) { return Err ( CryptoError :: InvalidArgument { message : format ! ( " " threshold get ( ) signatures iter ( ) filter ( s s is_some ( ) ) count ( ) ) , } ) ; } if signatures . is_empty ( ) { return Ok ( Signature :: identity ( ) ) ; } let signatures : Vec < ( Scalar , Signature ) > = signatures . iter ( ) . zip ( 0_u32 .. ) . filter_map ( | ( signature , index ) | signature . map ( | signature | ( x_for_index ( index ) , signature ) ) ) . collect ( ) ; Ok ( PublicCoefficients :: interpolate_g1 ( & signatures ) . expect ( " " ) ) }
Combines signature shares (i.e.
Combines signature shares ( i . e .
signatures
&[Option<Signature>]
threshold
NumberOfNodes
errors
`CryptoError::InvalidArgument` if the given signature shares are lower
than the given threshold.
` CryptoError :: InvalidArgument ` if the given signature shares are lower than the given threshold .