core: avoid write existing block again (#14849)
This commit is contained in:
		@@ -827,6 +827,11 @@ func (bc *BlockChain) WriteBlock(block *types.Block) (status WriteStatus, err er
 | 
				
			|||||||
	bc.mu.Lock()
 | 
						bc.mu.Lock()
 | 
				
			||||||
	defer bc.mu.Unlock()
 | 
						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())
 | 
						localTd := bc.GetTd(bc.currentBlock.Hash(), bc.currentBlock.NumberU64())
 | 
				
			||||||
	externTd := new(big.Int).Add(block.Difficulty(), ptd)
 | 
						externTd := new(big.Int).Add(block.Difficulty(), ptd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user