pub fn receive_commitments(
        self,
        nonce_commitments: Vec<NonceCommitment>,
    ) -> Result<(PartyAwaitingShares, Scalar), MusigError> {
        // Make R = sum_i(R_i). nonce_commitments = R_i from all the parties.
        let R = NonceCommitment::sum(&nonce_commitments);

        // Check stored precommitments against received commitments
        let counterparties = self
            .counterparties
            .into_iter()
            .zip(nonce_commitments)
            .map(|(counterparty, commitment)| counterparty.commit_nonce(commitment))
            .collect::<Result<_, _>>()?;

        // Make c = H(X, R, m)
        // The message `m` has already been fed into the transcript.
        let c = {
            self.transcript
                .commit_point(b"X", &self.multikey.aggregated_key().0);
            self.transcript.commit_point(b"R", &R.compress());
            self.transcript.challenge_scalar(b"c")
        };

        // Make a_i = H(L, X_i)
        let X_i = VerificationKey((self.x_i * RISTRETTO_BASEPOINT_POINT).compress());
        let a_i = self.multikey.factor_for_key(&X_i);

        // Generate share: s_i = r_i + c * a_i * x_i
        let s_i = self.r_i + c * a_i * self.x_i;

        // Store received nonce commitments in next state
        Ok((
            PartyAwaitingShares {
                multikey: self.multikey,
                c,
                R,
                counterparties,
            },
            s_i,
        ))
    }
/// Provide nonce commitments to the party and transition to the next round
/// if they match the precommitments.
Provide nonce commitments to the party and transition to the next round
if they match the precommitments.
Provide nonce commitments to the party and transition to the next round if they match the precommitments .
pub fn receive_commitments(
        self,
        nonce_commitments: Vec<NonceCommitment>,
    ) -> Result<(PartyAwaitingShares, Scalar), MusigError> {
        // Make R = sum_i(R_i). nonce_commitments = R_i from all the parties.
        let R = NonceCommitment::sum(&nonce_commitments);
        // Check stored precommitments against received commitments
        let counterparties = self
            .counterparties
            .into_iter()
            .zip(nonce_commitments)
            .map(|(counterparty, commitment)| counterparty.commit_nonce(commitment))
            .collect::<Result<_, _>>()?;
        // Make c = H(X, R, m)
        // The message `m` has already been fed into the transcript.
        let c = {
            self.transcript
                .commit_point(b"X", &self.multikey.aggregated_key().0);
            self.transcript.commit_point(b"R", &R.compress());
            self.transcript.challenge_scalar(b"c")
        };
        // Make a_i = H(L, X_i)
        let X_i = VerificationKey((self.x_i * RISTRETTO_BASEPOINT_POINT).compress());
        let a_i = self.multikey.factor_for_key(&X_i);
        // Generate share: s_i = r_i + c * a_i * x_i
        let s_i = self.r_i + c * a_i * self.x_i;
        // Store received nonce commitments in next state
        Ok((
            PartyAwaitingShares {
                multikey: self.multikey,
                c,
                R,
                counterparties,
            },
            s_i,
        ))
    }
pub fn receive_commitments ( self , nonce_commitments : Vec < NonceCommitment > , ) -> Result < ( PartyAwaitingShares , Scalar ) , MusigError > { // Make R = sum_i(R_i). nonce_commitments = R_i from all the parties. let R = NonceCommitment :: sum ( & nonce_commitments ) ; // Check stored precommitments against received commitments let counterparties = self . counterparties . into_iter ( ) . zip ( nonce_commitments ) . map ( | ( counterparty , commitment ) | counterparty . commit_nonce ( commitment ) ) . collect :: < Result < _ , _ > > ( ) ? ; // Make c = H(X, R, m) // The message `m` has already been fed into the transcript. let c = { self . transcript . commit_point ( b" " , & self . multikey . aggregated_key ( ) . 0 ) ; self . transcript . commit_point ( b" " , & R . compress ( ) ) ; self . transcript . challenge_scalar ( b" " ) } ; // Make a_i = H(L, X_i) let X_i = VerificationKey ( ( self . x_i * RISTRETTO_BASEPOINT_POINT ) . compress ( ) ) ; let a_i = self . multikey . factor_for_key ( & X_i ) ; // Generate share: s_i = r_i + c * a_i * x_i let s_i = self . r_i + c * a_i * self . x_i ; // Store received nonce commitments in next state Ok ( ( PartyAwaitingShares { multikey : self . multikey , c , R , counterparties , } , s_i , ) ) }
Provide nonce commitments to the party and transition to the next round
if they match the precommitments.
Provide nonce commitments to the party and transition to the next round if they match the precommitments .
self
nonce_commitments
Vec<NonceCommitment>
self
nonce_commitments
Vec<NonceCommitment>