Skip to content

Commit edad47b

Browse files
committed
eth/downloader: fix leftover state between syncs
1 parent bd5720f commit edad47b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

eth/downloader/downloader.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ func (d *Downloader) Synchronise(id string, hash common.Hash) error {
130130
defer atomic.StoreInt32(&d.synchronising, 0)
131131

132132
// Abort if the queue still contains some leftover data
133-
if _, cached := d.queue.Size(); cached > 0 {
133+
if _, cached := d.queue.Size(); cached > 0 && d.queue.GetHeadBlock() != nil {
134134
return errPendingQueue
135135
}
136+
// Reset the queue to clean any internal leftover state
137+
d.queue.Reset()
138+
136139
// Retrieve the origin peer and initiate the downloading process
137140
p := d.peers[id]
138141
if p == nil {

0 commit comments

Comments
 (0)