pub fn filter_dealings(
        verified_dealings: &BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes>,
        verified_responses: &[Option<CLibVerifiedResponseBytes>],
    ) -> Result<BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes>, DkgCreateTranscriptError> {
        let dealings: BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes> = {
            let mut dealings = verified_dealings.clone();
            for response in verified_responses.iter().flatten() {
                for (dealer_public_key, complaint_maybe) in response.complaints.iter() {
                    if complaint_maybe.is_some() {
                        dealings.remove(dealer_public_key);
                    }
                }
            }
            dealings
        };

        if dealings.is_empty() {
            return Err(DkgCreateTranscriptError::InsufficientDataError(
                InvalidArgumentError {
                    message: "Insufficient dealings to run DKG safely".to_string(),
                },
            ));
        }
        Ok(dealings)
    }
/// Remove the dealings that have valid complaints.
Remove the dealings that have valid complaints.
Remove the dealings that have valid complaints .
pub fn filter_dealings(
        verified_dealings: &BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes>,
        verified_responses: &[Option<CLibVerifiedResponseBytes>],
    ) -> Result<BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes>, DkgCreateTranscriptError> {
        let dealings: BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes> = {
            let mut dealings = verified_dealings.clone();
            for response in verified_responses.iter().flatten() {
                for (dealer_public_key, complaint_maybe) in response.complaints.iter() {
                    if complaint_maybe.is_some() {
                        dealings.remove(dealer_public_key);
                    }
                }
            }
            dealings
        };
        if dealings.is_empty() {
            return Err(DkgCreateTranscriptError::InsufficientDataError(
                InvalidArgumentError {
                    message: "Insufficient dealings to run DKG safely".to_string(),
                },
            ));
        }
        Ok(dealings)
    }
pub fn filter_dealings ( verified_dealings : & BTreeMap < EphemeralPublicKeyBytes , CLibDealingBytes > , verified_responses : & [ Option < CLibVerifiedResponseBytes > ] , ) -> Result < BTreeMap < EphemeralPublicKeyBytes , CLibDealingBytes > , DkgCreateTranscriptError > { let dealings : BTreeMap < EphemeralPublicKeyBytes , CLibDealingBytes > = { let mut dealings = verified_dealings . clone ( ) ; for response in verified_responses . iter ( ) . flatten ( ) { for ( dealer_public_key , complaint_maybe ) in response . complaints . iter ( ) { if complaint_maybe . is_some ( ) { dealings . remove ( dealer_public_key ) ; } } } dealings } ; if dealings . is_empty ( ) { return Err ( DkgCreateTranscriptError :: InsufficientDataError ( InvalidArgumentError { message : " " . to_string ( ) , } , ) ) ; } Ok ( dealings ) }
Remove the dealings that have valid complaints.
Remove the dealings that have valid complaints .
verified_dealings
&BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes>
verified_responses
&[Option<CLibVerifiedResponseBytes>]
verified_dealings
&BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes>
verified_responses
&[Option<CLibVerifiedResponseBytes>]