miner: don't verify our own blocks, trust the engine

This commit is contained in:
Péter Szilágyi 2017-04-06 12:22:14 +03:00
parent 3d8de95f99
commit d83a9a8f44
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D

View File

@ -279,21 +279,11 @@ func (self *worker) wait() {
go self.mux.Post(core.NewMinedBlockEvent{Block: block}) go self.mux.Post(core.NewMinedBlockEvent{Block: block})
} else { } else {
work.state.Commit(self.config.IsEIP158(block.Number())) work.state.Commit(self.config.IsEIP158(block.Number()))
parent := self.chain.GetBlock(block.ParentHash(), block.NumberU64()-1)
if parent == nil {
log.Error("Invalid block found during mining")
continue
}
if err := self.engine.VerifyHeader(self.chain, block.Header(), false); err != nil {
log.Error("Invalid header on mined block", "err", err)
continue
}
stat, err := self.chain.WriteBlock(block) stat, err := self.chain.WriteBlock(block)
if err != nil { if err != nil {
log.Error("Failed writing block to chain", "err", err) log.Error("Failed writing block to chain", "err", err)
continue continue
} }
// update block hash since it is now available and not when the receipt/log of individual transactions were created // update block hash since it is now available and not when the receipt/log of individual transactions were created
for _, r := range work.receipts { for _, r := range work.receipts {
for _, l := range r.Logs { for _, l := range r.Logs {