Improve PublicKey Hash impl efficiency

Instead of SSZ-encoding, we just use the AMCL tobytes method.
This commit is contained in:
Paul Hauner 2019-03-11 19:01:44 +11:00
parent 5e5cfb782e
commit 7e79a2b3d3
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6

View File

@ -93,7 +93,11 @@ impl PartialEq for PublicKey {
impl Hash for PublicKey {
fn hash<H: Hasher>(&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)
}
}