mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-01 00:53:47 +00:00
eth/downloader: improve nil pointer protection (#32222)
Fix #32221 --------- Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
This commit is contained in:
parent
61d7279e1f
commit
532a1c2ca4
2 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue