aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/queue.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/downloader/queue.go')
-rw-r--r--eth/downloader/queue.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index 4d1aa4e93..df3bf7087 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -31,6 +31,17 @@ func newqueue() *queue {
}
}
+func (c *queue) reset() {
+ c.mu.Lock()
+ defer c.mu.Unlock()
+
+ c.hashPool.Clear()
+ c.fetchPool.Clear()
+ c.blockHashes.Clear()
+ c.blocks = nil
+ c.fetching = make(map[string]*chunk)
+}
+
// reserve a `max` set of hashes for `p` peer.
func (c *queue) get(p *peer, max int) *chunk {
c.mu.Lock()