Commit edad47bf authored by Péter Szilágyi's avatar Péter Szilágyi

eth/downloader: fix leftover state between syncs

parent bd5720f4
...@@ -130,9 +130,12 @@ func (d *Downloader) Synchronise(id string, hash common.Hash) error { ...@@ -130,9 +130,12 @@ func (d *Downloader) Synchronise(id string, hash common.Hash) error {
defer atomic.StoreInt32(&d.synchronising, 0) defer atomic.StoreInt32(&d.synchronising, 0)
// Abort if the queue still contains some leftover data // 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 return errPendingQueue
} }
// Reset the queue to clean any internal leftover state
d.queue.Reset()
// Retrieve the origin peer and initiate the downloading process // Retrieve the origin peer and initiate the downloading process
p := d.peers[id] p := d.peers[id]
if p == nil { if p == nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment