Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dot/sync): add nil header checks #2099

Merged
merged 4 commits into from
Dec 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions dot/sync/chain_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,19 @@ func handleReadyBlock(bd *types.BlockData, pendingBlocks DisjointBlockSet, ready
// if we're expecting headers, validate should ensure we have a header
if bd.Header == nil {
block := pendingBlocks.getBlock(bd.Hash)
if block == nil {
logger.Criticalf("block with unknown header is ready: hash=%s", bd.Hash)
return
}

bd.Header = block.header
}

if bd.Header == nil {
logger.Criticalf("new ready block number (unknown) with hash %s", bd.Hash)
return
}

logger.Tracef("new ready block number %s with hash %s", bd.Header.Number, bd.Hash)

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