mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
core: avoid write existing block again (#14849)
This commit is contained in:
parent
ee748d1451
commit
4f9789b28d
1 changed files with 5 additions and 0 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue