From 7e79a2b3d31032e2acf62e6b02a1435b7b1dd646 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 11 Mar 2019 19:01:44 +1100 Subject: [PATCH] Improve PublicKey Hash impl efficiency Instead of SSZ-encoding, we just use the AMCL tobytes method. --- eth2/utils/bls/src/public_key.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eth2/utils/bls/src/public_key.rs b/eth2/utils/bls/src/public_key.rs index 3ab2b60bbb..ffe710d2da 100644 --- a/eth2/utils/bls/src/public_key.rs +++ b/eth2/utils/bls/src/public_key.rs @@ -93,7 +93,11 @@ impl PartialEq for PublicKey { impl Hash for PublicKey { fn hash(&self, state: &mut H) { - ssz_encode(self).hash(state) + // Note: this is not necessarily the consensus-ready hash. Instead, it is designed to be + // optimally fast for internal usage. + // + // To hash for consensus purposes, use the SSZ-encoded bytes. + self.0.as_bytes().hash(state) } }