Skip to content

Commit

Permalink
cleanup unused hash_with impl (#3207)
Browse files Browse the repository at this point in the history
  • Loading branch information
antiochp authored Jan 28, 2020
1 parent a1b6c31 commit 2f1e829
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
20 changes: 1 addition & 19 deletions core/src/core/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -38,17 +37,6 @@ pub struct Hash([u8; 32]);

impl DefaultHashable for Hash {}

impl Hash {
fn hash_with<T: Writeable>(&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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -234,6 +215,7 @@ pub trait Hashed {
/// Implementing this trait enables the default
/// hash implementation
pub trait DefaultHashable: Writeable {}

impl<D: DefaultHashable> Hashed for D {
fn hash(&self) -> Hash {
let mut hasher = HashWriter::default();
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 2f1e829

Please sign in to comment.