Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup unused hash_with impl #3207

Merged
merged 1 commit into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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