Skip to content

Commit

Permalink
aggregated seckey should be negated based on parity accumulator, not …
Browse files Browse the repository at this point in the history
…untweaked pubkey parity
  • Loading branch information
conduition committed Mar 20, 2024
1 parent 2ea653b commit cbbf6cc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/key_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,12 @@ impl KeyAggContext {
&self,
seckeys: impl IntoIterator<Item = Scalar>,
) -> Result<T, InvalidSecretKeysError> {
let group_untweaked_pubkey: Point = self.aggregated_pubkey_untweaked();

let mut group_seckey = MaybeScalar::Zero;
for (i, seckey) in seckeys.into_iter().enumerate() {
let key_coeff = *self.key_coefficients.get(i).ok_or(InvalidSecretKeysError)?;
group_seckey += seckey * key_coeff;
}
group_seckey = group_seckey.negate_if(group_untweaked_pubkey.parity());
group_seckey = group_seckey.negate_if(self.parity_acc);

let group_tweaked_seckey = (group_seckey + self.tweak_acc).not_zero()?;

Expand Down

0 comments on commit cbbf6cc

Please sign in to comment.