diff options
author | Determinant <[email protected]> | 2020-07-22 23:31:01 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-07-23 22:20:32 -0400 |
commit | 43af06a5fbf3808519b94db7aec1d01f2e753e94 (patch) | |
tree | 0b253a89e05c4807c5d448ec07467b609d35002d /coreth.go | |
parent | 13ebd8bd9468e9d769d598b0ca2afb72ba78cb97 (diff) |
verify whether Block fields are in agreement with the header
Diffstat (limited to 'coreth.go')
-rw-r--r-- | coreth.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -84,6 +84,16 @@ func (self *ETHChain) GenBlock() { self.backend.Miner().GenBlock() } +func (self *ETHChain) VerifyBlock(block *types.Block) bool { + txnHash := types.DeriveSha(block.Transactions()) + uncleHash := types.CalcUncleHash(block.Uncles()) + ethHeader := block.Header() + if txnHash != ethHeader.TxHash || uncleHash != ethHeader.UncleHash { + return false + } + return true +} + func (self *ETHChain) PendingSize() (int, error) { pending, err := self.backend.TxPool().Pending() count := 0 |