/// Gets the share for one receiver from all dealings.
Gets the share for one receiver from all dealings.
Gets the share for one receiver from all dealings .
fn combined_receiver_share(
            dealings: &BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes>,
            receiver_index: usize,
        ) -> Result<EncryptedShareBytes, DkgCreateTranscriptError> {
            // Collect the shares for one receiver:
            let shares: Result<Vec<EncryptedShare>, DkgCreateTranscriptError> = dealings
                .iter()
                .map(|(_dealer_public_key, dealing)| {
                    EncryptedShare::try_from(
                        dealing
                            .receiver_data
                            .get(receiver_index)
                            .ok_or_else(|| {
                                DkgCreateTranscriptError::MalformedDealingError(
                                    MalformedDataError {
                                        algorithm: AlgorithmId::Secp256k1,
                                        internal_error: "Receiver index out of range".to_string(),
                                        data: None,
                                    },
                                )
                            })?
                            .ok_or(DkgCreateTranscriptError::MalformedDealingError(
                                MalformedDataError {
                                    algorithm: AlgorithmId::Secp256k1,
                                    internal_error: "Missing share from dealer".to_string(),
                                    data: None,
                                },
                            ))?,
                    )
                    .map_err(|_| {
                        DkgCreateTranscriptError::MalformedDealingError(MalformedDataError {
                            algorithm: AlgorithmId::Secp256k1,
                            internal_error: "Malformed share".to_string(),
                            data: None,
                        })
                    })
                })
                .collect();
            let combined_share: EncryptedShare =
                shares?.iter().fold(EncryptedShare::zero(), |mut acc, x| {
                    acc.add_assign(x);
                    acc
                });
            Ok(EncryptedShareBytes::from(combined_share))
        }
fn combined_receiver_share ( dealings : & BTreeMap < EphemeralPublicKeyBytes , CLibDealingBytes > , receiver_index : usize , ) -> Result < EncryptedShareBytes , DkgCreateTranscriptError > { // Collect the shares for one receiver: let shares : Result < Vec < EncryptedShare > , DkgCreateTranscriptError > = dealings . iter ( ) . map ( | ( _dealer_public_key , dealing ) | { EncryptedShare :: try_from ( dealing . receiver_data . get ( receiver_index ) . ok_or_else ( | | { DkgCreateTranscriptError :: MalformedDealingError ( MalformedDataError { algorithm : AlgorithmId :: Secp256k1 , internal_error : " " . to_string ( ) , data : None , } , ) } ) ? . ok_or ( DkgCreateTranscriptError :: MalformedDealingError ( MalformedDataError { algorithm : AlgorithmId :: Secp256k1 , internal_error : " " . to_string ( ) , data : None , } , ) ) ? , ) . map_err ( | _ | { DkgCreateTranscriptError :: MalformedDealingError ( MalformedDataError { algorithm : AlgorithmId :: Secp256k1 , internal_error : " " . to_string ( ) , data : None , } ) } ) } ) . collect ( ) ; let combined_share : EncryptedShare = shares ? . iter ( ) . fold ( EncryptedShare :: zero ( ) , | mut acc , x | { acc . add_assign ( x ) ; acc } ) ; Ok ( EncryptedShareBytes :: from ( combined_share ) ) }
Gets the share for one receiver from all dealings.
Gets the share for one receiver from all dealings .
dealings
&BTreeMap<EphemeralPublicKeyBytes, CLibDealingBytes>
receiver_index
usize