eth/downloader/downloader.go : potential panic

This commit is contained in:
ucwong 2023-11-24 18:13:37 +08:00
parent bdf5e388ca
commit d4672ea2f8

View file

@ -1614,6 +1614,10 @@ func (d *Downloader) processSnapSyncContent() error {
} }
// Split around the pivot block and process the two sides via snap/full sync // Split around the pivot block and process the two sides via snap/full sync
if !d.committed.Load() { if !d.committed.Load() {
if len(results) == 0 {
continue
}
latest := results[len(results)-1].Header latest := results[len(results)-1].Header
// If the height is above the pivot block by 2 sets, it means the pivot // If the height is above the pivot block by 2 sets, it means the pivot
// become stale in the network, and it was garbage collected, move to a // become stale in the network, and it was garbage collected, move to a