Hashable::sha3 -> fn keccak for ethcore

This commit is contained in:
debris
2017-08-30 19:18:28 +02:00
parent e120c75d17
commit f0e8abb07b
69 changed files with 429 additions and 398 deletions

View File

@@ -16,7 +16,8 @@
//! View onto block header rlp
use util::{U256, Bytes, Hashable, H256, Address, H2048};
use hash::keccak;
use util::{U256, Bytes, H256, Address, H2048};
use rlp::Rlp;
use header::BlockNumber;
@@ -41,7 +42,9 @@ impl<'a> HeaderView<'a> {
}
/// Returns header hash.
pub fn hash(&self) -> H256 { self.sha3() }
pub fn hash(&self) -> H256 {
keccak(self.rlp.as_raw())
}
/// Returns raw rlp.
pub fn rlp(&self) -> &Rlp<'a> { &self.rlp }
@@ -95,12 +98,6 @@ impl<'a> HeaderView<'a> {
}
}
impl<'a> Hashable for HeaderView<'a> {
fn sha3(&self) -> H256 {
self.rlp.as_raw().sha3()
}
}
#[cfg(test)]
mod tests {
use std::str::FromStr;