aboutsummaryrefslogtreecommitdiff
path: root/coreth.go
diff options
context:
space:
mode:
authorDeterminant <tederminant@gmail.com>2020-07-22 23:31:01 -0400
committerDeterminant <tederminant@gmail.com>2020-07-23 22:20:32 -0400
commit43af06a5fbf3808519b94db7aec1d01f2e753e94 (patch)
tree0b253a89e05c4807c5d448ec07467b609d35002d /coreth.go
parent13ebd8bd9468e9d769d598b0ca2afb72ba78cb97 (diff)
verify whether Block fields are in agreement with the header
Diffstat (limited to 'coreth.go')
-rw-r--r--coreth.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/coreth.go b/coreth.go
index b7e45af..baa82be 100644
--- a/coreth.go
+++ b/coreth.go
@@ -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