mirror of
https://github.com/mimblewimble/grin.git
synced 2025-04-24 03:11:14 +03:00
Hashed impl only needed for empty arrays.
This commit is contained in:
parent
fd26ec9753
commit
afb219ce5c
2 changed files with 4 additions and 4 deletions
|
@ -110,11 +110,11 @@ impl<W: ser::Writeable> Hashed for W {
|
|||
}
|
||||
}
|
||||
|
||||
impl Hashed for [u8] {
|
||||
// Convenience for when we need to hash of an empty array.
|
||||
impl Hashed for [u8; 0] {
|
||||
fn hash(&self) -> Hash {
|
||||
let mut hasher = HashWriter::default();
|
||||
let hasher = HashWriter::default();
|
||||
let mut ret = [0; 32];
|
||||
ser::Writer::write_fixed_bytes(&mut hasher, &self).unwrap();
|
||||
hasher.finalize(&mut ret);
|
||||
Hash(ret)
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ impl MerkleRow {
|
|||
}
|
||||
fn root(&self) -> Hash {
|
||||
if self.0.len() == 0 {
|
||||
vec![].hash()
|
||||
[].hash()
|
||||
} else if self.0.len() == 1 {
|
||||
self.0[0].hash()
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue