From edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 8 May 2015 17:21:11 +0300 Subject: [PATCH] eth/downloader: fix leftover state between syncs --- eth/downloader/downloader.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 {