aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/queue.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-19 00:54:57 +0800
committerobscuren <geffobscura@gmail.com>2015-04-19 00:55:13 +0800
commitc2c24b3bb419a8ffffb58ec25788b951bef779f9 (patch)
tree1d646493e36a0056b1d34fc8e876a9a5123c3fa2 /eth/downloader/queue.go
parent60613b57d1956275bb475a53b5085c4ead4ceb2c (diff)
downloadgo-tangerine-c2c24b3bb419a8ffffb58ec25788b951bef779f9.tar.gz
go-tangerine-c2c24b3bb419a8ffffb58ec25788b951bef779f9.tar.zst
go-tangerine-c2c24b3bb419a8ffffb58ec25788b951bef779f9.zip
downloader: improved downloading and synchronisation
* Downloader's peers keeps track of peer's previously requested hashes so that we don't have to re-request * Changed `AddBlock` to be fully synchronous
Diffstat (limited to 'eth/downloader/queue.go')
-rw-r--r--eth/downloader/queue.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index df3bf7087..5745bf1f8 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -65,6 +65,9 @@ func (c *queue) get(p *peer, max int) *chunk {
return true
})
+ // remove hashes that have previously been fetched
+ hashes.Separate(p.requested)
+
// remove the fetchable hashes from hash pool
c.hashPool.Separate(hashes)
c.fetchPool.Merge(hashes)