pub fn verify_all_shares_are_present_and_well_formatted(
    dealing: &Dealing,
    number_of_receivers: NumberOfNodes,
) -> Result<(), InvalidArgumentError> {
    // Check that all required indices are present:
    let num_encrypted_chunks = NodeIndex::try_from(dealing.ciphertexts.ciphertext_chunks.len());
    if num_encrypted_chunks != Ok(number_of_receivers.get()) {
        return Err(InvalidArgumentError {
            message: format!(
                "Incorrect number of shares.\n  Expected: {}\n  Got: {}",
                number_of_receivers.get(),
                dealing.ciphertexts.ciphertext_chunks.len()
            ),
        });
    }
    Ok(())
}
/// Verifies that shares are well formed and have the correct indices.
///
/// # Errors
/// * `InvalidArgumentError` if
///   - The share indices are not 0..num_receivers-1 inclusive.
///   - Any shares are malformed.
Verifies that shares are well formed and have the correct indices.
Verifies that shares are well formed and have the correct indices .
pub fn verify_all_shares_are_present_and_well_formatted(
    dealing: &Dealing,
    number_of_receivers: NumberOfNodes,
) -> Result<(), InvalidArgumentError> {
    // Check that all required indices are present:
    let num_encrypted_chunks = NodeIndex::try_from(dealing.ciphertexts.ciphertext_chunks.len());
    if num_encrypted_chunks != Ok(number_of_receivers.get()) {
        return Err(InvalidArgumentError {
            message: format!(
                "Incorrect number of shares.\n  Expected: {}\n  Got: {}",
                number_of_receivers.get(),
                dealing.ciphertexts.ciphertext_chunks.len()
            ),
        });
    }
    Ok(())
}
pub fn verify_all_shares_are_present_and_well_formatted ( dealing : & Dealing , number_of_receivers : NumberOfNodes , ) -> Result < ( ) , InvalidArgumentError > { // Check that all required indices are present: let num_encrypted_chunks = NodeIndex :: try_from ( dealing . ciphertexts . ciphertext_chunks . len ( ) ) ; if num_encrypted_chunks != Ok ( number_of_receivers . get ( ) ) { return Err ( InvalidArgumentError { message : format ! ( " \n \n " number_of_receivers get ( ) dealing ciphertexts ciphertext_chunks len ( ) ) , } ) ; } Ok ( ( ) ) }
Verifies that shares are well formed and have the correct indices.
Verifies that shares are well formed and have the correct indices .
dealing
&Dealing
number_of_receivers
NumberOfNodes
dealing
&Dealing
number_of_receivers
NumberOfNodes
errors
`InvalidArgumentError` if
The share indices are not 0..num_receivers-1 inclusive.
Any shares are malformed.
` InvalidArgumentError ` if The share indices are not 0 .. num_receivers - 1 inclusive . Any shares are malformed .