Files
lighthouse/eth2/utils/bls/src/aggregate_public_key.rs
Paul Hauner bfa2e71b46 Move PublicKey to store uncompressed bytes.
This is an optimisation that allows for faster hashing of a public key,
however it adds a penalty to SSZ encoding because we need to go
decompressed -> PublicKey -> compressed.

The spec presently uses compressed bytes to store public keys, however
I'm hoping it will change.
2019-03-13 14:41:43 +11:00

25 lines
651 B
Rust

use super::PublicKey;
use bls_aggregates::AggregatePublicKey as RawAggregatePublicKey;
/// A single BLS signature.
///
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
/// serialization).
#[derive(Debug, Clone, Default)]
pub struct AggregatePublicKey(RawAggregatePublicKey);
impl AggregatePublicKey {
pub fn new() -> Self {
AggregatePublicKey(RawAggregatePublicKey::new())
}
pub fn add(&mut self, public_key: &PublicKey) {
self.0.add(&public_key.as_raw())
}
/// Returns the underlying signature.
pub fn as_raw(&self) -> &RawAggregatePublicKey {
&self.0
}
}