diff --git a/eth/downloader/beaconsync.go b/eth/downloader/beaconsync.go index 33ad0f8971..12b74a1ba9 100644 --- a/eth/downloader/beaconsync.go +++ b/eth/downloader/beaconsync.go @@ -250,6 +250,9 @@ func (d *Downloader) findBeaconAncestor() (uint64, error) { check := (start + end) / 2 h := d.skeleton.Header(check) + if h == nil { + return 0, fmt.Errorf("filled skeleton header is missing: %d", check) + } n := h.Number.Uint64() var known bool diff --git a/eth/downloader/skeleton.go b/eth/downloader/skeleton.go index 206d28414e..2cf9c4672b 100644 --- a/eth/downloader/skeleton.go +++ b/eth/downloader/skeleton.go @@ -1150,6 +1150,9 @@ func (s *skeleton) cleanStales(filled *types.Header) error { if number < s.progress.Subchains[0].Head { // The skeleton chain is partially consumed, set the new tail as filled+1. tail := rawdb.ReadSkeletonHeader(s.db, number+1) + if tail == nil { + return fmt.Errorf("filled header is missing: %d", number+1) + } if tail.ParentHash != filled.Hash() { return fmt.Errorf("filled header is discontinuous with subchain: %d %s, please file an issue", number, filled.Hash()) }