aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/queue.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-11-04 18:18:48 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-11-04 19:11:52 +0800
commitb658a73ed5205b0f35fdff98e587140026be66e6 (patch)
treeb511a96d71ad16203aeed5cf59f8915af1522666 /eth/downloader/queue.go
parentdda3bf3ce7ef109541adb6f0020f8d2dd28e5e51 (diff)
downloaddexon-b658a73ed5205b0f35fdff98e587140026be66e6.tar.gz
dexon-b658a73ed5205b0f35fdff98e587140026be66e6.tar.zst
dexon-b658a73ed5205b0f35fdff98e587140026be66e6.zip
eth/downloader: fix dysfunctional ignore list hidden by generic set
Diffstat (limited to 'eth/downloader/queue.go')
-rw-r--r--eth/downloader/queue.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index 56b46e285..1fb5b6e12 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -501,7 +501,7 @@ func (q *queue) reserveHashes(p *peer, count int, taskQueue *prque.Prque, taskGe
for proc := 0; (allowance == 0 || proc < allowance) && len(send) < count && !taskQueue.Empty(); proc++ {
hash, priority := taskQueue.Pop()
- if p.ignored.Has(hash) {
+ if p.Lacks(hash.(common.Hash)) {
skip[hash.(common.Hash)] = int(priority)
} else {
send[hash.(common.Hash)] = int(priority)
@@ -607,7 +607,7 @@ func (q *queue) reserveHeaders(p *peer, count int, taskPool map[common.Hash]*typ
continue
}
// Otherwise unless the peer is known not to have the data, add to the retrieve list
- if p.ignored.Has(header.Hash()) {
+ if p.Lacks(header.Hash()) {
skip = append(skip, header)
} else {
send = append(send, header)
@@ -781,7 +781,7 @@ func (q *queue) DeliverBlocks(id string, blocks []*types.Block) error {
// If no blocks were retrieved, mark them as unavailable for the origin peer
if len(blocks) == 0 {
for hash, _ := range request.Hashes {
- request.Peer.ignored.Add(hash)
+ request.Peer.MarkLacking(hash)
}
}
// Iterate over the downloaded blocks and add each of them
@@ -877,8 +877,8 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header, taskQ
// If no data items were retrieved, mark them as unavailable for the origin peer
if results == 0 {
- for hash, _ := range request.Headers {
- request.Peer.ignored.Add(hash)
+ for _, header := range request.Headers {
+ request.Peer.MarkLacking(header.Hash())
}
}
// Assemble each of the results with their headers and retrieved data parts
@@ -944,7 +944,7 @@ func (q *queue) DeliverNodeData(id string, data [][]byte, callback func(error, i
// If no data was retrieved, mark their hashes as unavailable for the origin peer
if len(data) == 0 {
for hash, _ := range request.Hashes {
- request.Peer.ignored.Add(hash)
+ request.Peer.MarkLacking(hash)
}
}
// Iterate over the downloaded data and verify each of them