mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 06:14:38 +00:00
Merges in validator client branch
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user