Avoid redundant key computations.

This commit is contained in:
Andreas Fackler 2018-06-27 14:25:32 +02:00 committed by Vladimir Komendantskiy
parent e3a401bcb9
commit c0cef3b50b
2 changed files with 3 additions and 3 deletions

2
mod.rs
View File

@ -223,7 +223,7 @@ impl PublicKeySet {
/// Returns the public key. /// Returns the public key.
pub fn public_key(&self) -> PublicKey { pub fn public_key(&self) -> PublicKey {
PublicKey(self.commit.evaluate(0)) PublicKey(self.commit.coeff[0])
} }
/// Returns the `i`-th public key share. /// Returns the `i`-th public key share.

View File

@ -29,7 +29,7 @@ use rand::Rng;
pub struct Poly { pub struct Poly {
/// The coefficients of a polynomial. /// The coefficients of a polynomial.
#[serde(with = "super::serde_impl::field_vec")] #[serde(with = "super::serde_impl::field_vec")]
coeff: Vec<Fr>, pub(super) coeff: Vec<Fr>,
} }
impl<B: Borrow<Poly>> ops::AddAssign<B> for Poly { impl<B: Borrow<Poly>> ops::AddAssign<B> for Poly {
@ -246,7 +246,7 @@ impl Poly {
pub struct Commitment { pub struct Commitment {
/// The coefficients of the polynomial. /// The coefficients of the polynomial.
#[serde(with = "super::serde_impl::projective_vec")] #[serde(with = "super::serde_impl::projective_vec")]
coeff: Vec<G1>, pub(super) coeff: Vec<G1>,
} }
impl Hash for Commitment { impl Hash for Commitment {