diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-05-08 22:21:11 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-05-08 22:39:03 +0800 |
commit | edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e (patch) | |
tree | e204c3e267d848863a31cd6d29c858d2bbb18fab /eth | |
parent | bd5720f4804788d91154a10ef5bb10425c502658 (diff) | |
download | dexon-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar dexon-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.gz dexon-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.bz2 dexon-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.lz dexon-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.xz dexon-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.tar.zst dexon-edad47bf0e68ad02ee0cb6efd776c9f9be67ad8e.zip |
eth/downloader: fix leftover state between syncs
Diffstat (limited to 'eth')
-rw-r--r-- | eth/downloader/downloader.go | 5 |
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 { |