mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
downloader: fix edgecase where returned index is OOB for downloader
This commit is contained in:
parent
fe86a707d8
commit
8519224d55
1 changed files with 5 additions and 1 deletions
|
|
@ -1488,7 +1488,11 @@ func (d *Downloader) importBlockResults(results []*fetchResult) error {
|
|||
blocks[i] = types.NewBlockWithHeader(result.Header).WithBody(result.Transactions, result.Uncles)
|
||||
}
|
||||
if index, err := d.blockchain.InsertChain(blocks); err != nil {
|
||||
log.Debug("Downloaded item processing failed", "number", results[index].Header.Number, "hash", results[index].Header.Hash(), "err", err)
|
||||
if index < len(results) {
|
||||
log.Debug("Downloaded item processing failed", "number", results[index].Header.Number, "hash", results[index].Header.Hash(), "err", err)
|
||||
} else {
|
||||
log.Debug("Downloaded item processing failed on sidechain import", "index", index, "err", err)
|
||||
}
|
||||
return errInvalidChain
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue