aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/downloader.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/downloader/downloader.go')
-rw-r--r--eth/downloader/downloader.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index 1b9b7d01b..206c4cc7e 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -268,8 +268,14 @@ out:
chunk := d.queue.get(peer, maxBlockFetch)
if chunk != nil {
//fmt.Println("fetching for", peer.id)
- // Fetch the chunk.
- peer.fetch(chunk)
+ // Fetch the chunk and check for error. If the peer was somehow
+ // already fetching a chunk due to a bug, it will be returned to
+ // the queue
+ if err := peer.fetch(chunk); err != nil {
+ // log for tracing
+ glog.V(logger.Debug).Infof("peer %s received double work (state = %v)\n", peer.id, peer.state)
+ d.queue.put(chunk.hashes)
+ }
}
}
atomic.StoreInt32(&d.downloadingBlocks, 1)