Initial commit of v1.10.14 merge

This commit is contained in:
philip-morlier
2021-12-23 14:57:38 -08:00
parent 968e79b705
commit 15b7e55b50
4 changed files with 12 additions and 4 deletions
+7
View File
@@ -1293,6 +1293,13 @@ func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types
}
bc.futureBlocks.Remove(block.Hash())
ptd := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
if ptd == nil {
return WriteStatus(0), consensus.ErrUnknownAncestor
}
// Make sure no inconsistent state is leaked during insertion
externTd := new(big.Int).Add(block.Difficulty(), ptd)
if status == CanonStatTy {
pluginNewHead(block, block.Hash(), logs, externTd)
bc.chainFeed.Send(ChainEvent{Block: block, Hash: block.Hash(), Logs: logs})