diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index dc23354929..be534e5ef6 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -486,13 +486,16 @@ func (d *Downloader) spawnSync(fetchers []func() error) error { // Wait for the first error, then terminate the others. var err error for i := 0; i < len(fetchers); i++ { + err = <-errc + if i == len(fetchers)-1 { // Close the queue when all fetchers have exited. // This will cause the block processor to end when // it has processed the queue. d.queue.Close() } - if err = <-errc; err != nil { + + if err != nil { break } }