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

@@ -28,7 +28,8 @@ use header::{BlockNumber, Header as FullHeader};
use transaction::UnverifiedTransaction;
use views;
use util::{Address, Hashable, H256, H2048, U256, HeapSizeOf};
use util::{Address, H256, H2048, U256, HeapSizeOf};
use hash::keccak;
use rlp::Rlp;
/// Owning header view.
@@ -64,7 +65,7 @@ impl Header {
// forwarders to borrowed view.
impl Header {
/// Returns the header hash.
pub fn hash(&self) -> H256 { self.sha3() }
pub fn hash(&self) -> H256 { keccak(&self.0) }
/// Returns the parent hash.
pub fn parent_hash(&self) -> H256 { self.view().parent_hash() }
@@ -109,12 +110,6 @@ impl Header {
pub fn seal(&self) -> Vec<Vec<u8>> { self.view().seal() }
}
impl Hashable for Header {
fn sha3(&self) -> H256 {
self.0.sha3()
}
}
/// Owning block body view.
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "ipc", binary)]
@@ -218,7 +213,7 @@ impl Block {
// forwarders to borrowed header view.
impl Block {
/// Returns the header hash.
pub fn hash(&self) -> H256 { self.header_view().sha3() }
pub fn hash(&self) -> H256 { self.header_view().hash() }
/// Returns the parent hash.
pub fn parent_hash(&self) -> H256 { self.header_view().parent_hash() }