aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-05-08 22:21:11 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-05-08 22:39:03 +0800
commitedad47bf0e68ad02ee0cb6efd776c9f9be67ad8e (patch)
treee204c3e267d848863a31cd6d29c858d2bbb18fab
parentbd5720f4804788d91154a10ef5bb10425c502658 (diff)
downloadgo-tangerine-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar
go-tangerine-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.gz
go-tangerine-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.bz2
go-tangerine-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.lz
go-tangerine-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.xz
go-tangerine-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.zst
go-tangerine-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.zip
eth/downloader: fix leftover state between syncs
-rw-r--r--eth/downloader/downloader.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index a97cce1ef..18f8d2ba8 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -130,9 +130,12 @@ func (d *Downloader) Synchronise(id string, hash common.Hash) error {
defer atomic.StoreInt32(&d.synchronising, 0)
// Abort if the queue still contains some leftover data
- if _, cached := d.queue.Size(); cached > 0 {
+ if _, cached := d.queue.Size(); cached > 0 && d.queue.GetHeadBlock() != nil {
return errPendingQueue
}
+ // Reset the queue to clean any internal leftover state
+ d.queue.Reset()
+
// Retrieve the origin peer and initiate the downloading process
p := d.peers[id]
if p == nil {