Merges in validator client branch

This commit is contained in:
Age Manning
2019-03-30 13:17:24 +11:00
15 changed files with 129 additions and 73 deletions

View File

@@ -1,5 +1,6 @@
use super::{PublicKey, SecretKey};
use serde_derive::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Keypair {
@@ -19,3 +20,15 @@ impl Keypair {
self.pk.concatenated_hex_id()
}
}
impl Hash for Keypair {
/// Note: this is distinct from consensus serialization, it will produce a different hash.
///
/// This method uses the uncompressed bytes, which are much faster to obtain than the
/// compressed bytes required for consensus serialization.
///
/// Use `ssz::Encode` to obtain the bytes required for consensus hashing.
fn hash<H: Hasher>(&self, state: &mut H) {
self.pk.as_uncompressed_bytes().hash(state)
}
}