Make sure to not mark block header hash as invalid if only the body is wrong. (#11356)
* Patch invalid transaction root. * Add raw hash to bad and include fix for uncles too. * Fix submodules.
This commit is contained in:
@@ -27,9 +27,12 @@ pub use self::headers::Headers;
|
||||
|
||||
/// Something which can produce a hash and a parent hash.
|
||||
pub trait BlockLike {
|
||||
/// Get the hash of this item.
|
||||
/// Get the hash of this item - i.e. the header hash.
|
||||
fn hash(&self) -> H256;
|
||||
|
||||
/// Get a raw hash of this item - i.e. the hash of the RLP representation.
|
||||
fn raw_hash(&self) -> H256;
|
||||
|
||||
/// Get the hash of this item's parent.
|
||||
fn parent_hash(&self) -> H256;
|
||||
|
||||
@@ -160,6 +163,10 @@ pub mod blocks {
|
||||
self.header.hash()
|
||||
}
|
||||
|
||||
fn raw_hash(&self) -> H256 {
|
||||
hash::keccak(&self.bytes)
|
||||
}
|
||||
|
||||
fn parent_hash(&self) -> H256 {
|
||||
self.header.parent_hash().clone()
|
||||
}
|
||||
@@ -174,6 +181,10 @@ pub mod blocks {
|
||||
self.header.hash()
|
||||
}
|
||||
|
||||
fn raw_hash(&self) -> H256 {
|
||||
hash::keccak(&self.bytes)
|
||||
}
|
||||
|
||||
fn parent_hash(&self) -> H256 {
|
||||
self.header.parent_hash().clone()
|
||||
}
|
||||
@@ -197,6 +208,7 @@ pub mod headers {
|
||||
|
||||
impl BlockLike for Header {
|
||||
fn hash(&self) -> H256 { self.hash() }
|
||||
fn raw_hash(&self) -> H256 { self.hash() }
|
||||
fn parent_hash(&self) -> H256 { self.parent_hash().clone() }
|
||||
fn difficulty(&self) -> U256 { self.difficulty().clone() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user