aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/downloader/peer.go')
-rw-r--r--eth/downloader/peer.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go
index 91977f592..45ec1cbfd 100644
--- a/eth/downloader/peer.go
+++ b/eth/downloader/peer.go
@@ -78,7 +78,7 @@ func newPeer(id string, hash common.Hash, getHashes hashFetcherFn, getBlocks blo
}
// fetch a chunk using the peer
-func (p *peer) fetch(chunk *chunk) error {
+func (p *peer) fetch(request *fetchRequest) error {
p.mu.Lock()
defer p.mu.Unlock()
@@ -88,13 +88,12 @@ func (p *peer) fetch(chunk *chunk) error {
// set working state
p.state = workingState
- // convert the set to a fetchable slice
- hashes, i := make([]common.Hash, chunk.hashes.Size()), 0
- chunk.hashes.Each(func(v interface{}) bool {
- hashes[i] = v.(common.Hash)
- i++
- return true
- })
+
+ // Convert the hash set to a fetchable slice
+ hashes := make([]common.Hash, 0, len(request.Hashes))
+ for hash, _ := range request.Hashes {
+ hashes = append(hashes, hash)
+ }
p.getBlocks(hashes)
return nil