mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
core: fix missing nil check, close XFN-114 (#1696)
This commit is contained in:
parent
307b127063
commit
aab6e89242
1 changed files with 4 additions and 0 deletions
|
|
@ -1703,6 +1703,10 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, []
|
||||||
var winner []*types.Block
|
var winner []*types.Block
|
||||||
|
|
||||||
parent := bc.GetBlock(block.ParentHash(), block.NumberU64()-1)
|
parent := bc.GetBlock(block.ParentHash(), block.NumberU64()-1)
|
||||||
|
if parent == nil {
|
||||||
|
log.Error("[insertChain] fail to get parent block", "number", block.NumberU64()-1, "hash", block.ParentHash())
|
||||||
|
return i, events, coalescedLogs, fmt.Errorf("fail to get parent block, number: %v, hash: %v", block.NumberU64()-1, block.ParentHash())
|
||||||
|
}
|
||||||
for !bc.HasFullState(parent) {
|
for !bc.HasFullState(parent) {
|
||||||
winner = append(winner, parent)
|
winner = append(winner, parent)
|
||||||
parent = bc.GetBlock(parent.ParentHash(), parent.NumberU64()-1)
|
parent = bc.GetBlock(parent.ParentHash(), parent.NumberU64()-1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue