Downloader panics on nil parentTd (#2148)

* fix

* restore testdata
This commit is contained in:
Evgeny Danilenko 2021-06-11 18:41:24 +03:00 committed by GitHub
parent 925d17a238
commit 4928de2280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -697,7 +697,7 @@ func (hi *HeaderInserter) FeedHeader(db ethdb.StatelessRwTx, header *types.Heade
}
// Parent's total difficulty
parentTd, err := rawdb.ReadTd(db, header.ParentHash, blockHeight-1)
if err != nil {
if err != nil || parentTd == nil {
return fmt.Errorf("[%s] parent's total difficulty not found with hash %x and height %d for header %x %d: %v", hi.logPrefix, header.ParentHash, blockHeight-1, hash, blockHeight, err)
}
// Calculate total difficulty of this header using parent's total difficulty