From 2f1e8299b1e3c26298e28b8bc5c61162f4bacff6 Mon Sep 17 00:00:00 2001 From: Antioch Peverell Date: Tue, 28 Jan 2020 11:40:21 +0000 Subject: [PATCH] cleanup unused hash_with impl (#3207) --- core/src/core/hash.rs | 20 +------------------- core/src/core/transaction.rs | 2 +- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/core/src/core/hash.rs b/core/src/core/hash.rs index f5ad0c76d..2da8fb231 100644 --- a/core/src/core/hash.rs +++ b/core/src/core/hash.rs @@ -24,7 +24,6 @@ use blake2::blake2b::Blake2b; use byteorder::{BigEndian, ByteOrder}; use std::cmp::min; use std::convert::AsRef; -use std::ops::Add; use std::{fmt, ops}; use util; @@ -38,17 +37,6 @@ pub struct Hash([u8; 32]); impl DefaultHashable for Hash {} -impl Hash { - fn hash_with(&self, other: T) -> Hash { - let mut hasher = HashWriter::default(); - ser::Writeable::write(self, &mut hasher).unwrap(); - ser::Writeable::write(&other, &mut hasher).unwrap(); - let mut ret = [0; 32]; - hasher.finalize(&mut ret); - Hash(ret) - } -} - impl fmt::Debug for Hash { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let hash_hex = self.to_hex(); @@ -168,13 +156,6 @@ impl Writeable for Hash { } } -impl Add for Hash { - type Output = Hash; - fn add(self, other: Hash) -> Hash { - self.hash_with(other) - } -} - impl Default for Hash { fn default() -> Hash { ZERO_HASH @@ -234,6 +215,7 @@ pub trait Hashed { /// Implementing this trait enables the default /// hash implementation pub trait DefaultHashable: Writeable {} + impl Hashed for D { fn hash(&self) -> Hash { let mut hasher = HashWriter::default(); diff --git a/core/src/core/transaction.rs b/core/src/core/transaction.rs index 536346646..5ded6a559 100644 --- a/core/src/core/transaction.rs +++ b/core/src/core/transaction.rs @@ -345,7 +345,7 @@ impl Readable for TxKernel { } /// We store kernels in the kernel MMR. -/// Note: These are "variable size" to support different kernel featuere variants. +/// Note: These are "variable size" to support different kernel feature variants. impl PMMRable for TxKernel { type E = Self;