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
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user