Hashed impl only needed for empty arrays.

This commit is contained in:
Ignotus Peverell
2017-04-03 18:10:55 -07:00
parent fd26ec9753
commit afb219ce5c
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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)
}
+1 -1
View File
@@ -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 {