Skip to content

Commit

Permalink
fix nil point in downloader (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
unclezoro authored Sep 6, 2021
1 parent 2d2740e commit 1540ad9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eth/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,10 @@ func (d *Downloader) findAncestorBinarySearch(p *peerConnection, mode SyncMode,
break
}
header := d.lightchain.GetHeaderByHash(h) // Independent of sync mode, header surely exists
if header == nil {
p.log.Error("header not found", "number", header.Number, "hash", header.Hash(), "request", check)
return 0, fmt.Errorf("%w: header no found (%d)", errBadPeer, header.Number)
}
if header.Number.Uint64() != check {
p.log.Warn("Received non requested header", "number", header.Number, "hash", header.Hash(), "request", check)
return 0, fmt.Errorf("%w: non-requested header (%d)", errBadPeer, header.Number)
Expand Down

0 comments on commit 1540ad9

Please sign in to comment.