Skip to content

Commit abbefce

Browse files
noottimwu20
authored andcommitted
fix(dot/sync): add nil header checks (ChainSafe#2099)
1 parent 5b57dd7 commit abbefce

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

dot/sync/chain_sync.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,9 +711,19 @@ func handleReadyBlock(bd *types.BlockData, pendingBlocks DisjointBlockSet, ready
711711
// if we're expecting headers, validate should ensure we have a header
712712
if bd.Header == nil {
713713
block := pendingBlocks.getBlock(bd.Hash)
714+
if block == nil {
715+
logger.Criticalf("block with unknown header is ready: hash=%s", bd.Hash)
716+
return
717+
}
718+
714719
bd.Header = block.header
715720
}
716721

722+
if bd.Header == nil {
723+
logger.Criticalf("new ready block number (unknown) with hash %s", bd.Hash)
724+
return
725+
}
726+
717727
logger.Tracef("new ready block number %s with hash %s", bd.Header.Number, bd.Hash)
718728

719729
ready := []*types.BlockData{bd}

0 commit comments

Comments
 (0)