eth/downloader: fix #1178, don't request blocks beyond the cache bounds

This commit is contained in:
Péter Szilágyi
2015-06-04 14:51:14 +03:00
parent 8610314918
commit 28c32d1b1b
3 changed files with 35 additions and 15 deletions

View File

@ -225,7 +225,7 @@ func (q *queue) Reserve(p *peer) *fetchRequest {
skip := make(map[common.Hash]int)
capacity := p.Capacity()
for len(send) < space && len(send) < capacity && !q.hashQueue.Empty() {
for proc := 0; proc < space && len(send) < capacity && !q.hashQueue.Empty(); proc++ {
hash, priority := q.hashQueue.Pop()
if p.ignored.Has(hash) {
skip[hash.(common.Hash)] = int(priority)