Commit 4f9789b2 authored by Mark's avatar Mark Committed by Felix Lange

core: avoid write existing block again (#14849)

parent ee748d14
......@@ -827,6 +827,11 @@ func (bc *BlockChain) WriteBlock(block *types.Block) (status WriteStatus, err er
bc.mu.Lock()
defer bc.mu.Unlock()
if bc.HasBlock(block.Hash()) {
log.Trace("Block existed", "hash", block.Hash())
return
}
localTd := bc.GetTd(bc.currentBlock.Hash(), bc.currentBlock.NumberU64())
externTd := new(big.Int).Add(block.Difficulty(), ptd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment