mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-20 19:11:08 +03:00
cleanup unused hash_with impl (#3207)
This commit is contained in:
parent
a1b6c31481
commit
2f1e8299b1
2 changed files with 2 additions and 20 deletions
|
@ -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<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();
|
||||
|
@ -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<D: DefaultHashable> Hashed for D {
|
||||
fn hash(&self) -> Hash {
|
||||
let mut hasher = HashWriter::default();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue