diff options
author | Daniel A. Nagy <nagy.da@gmail.com> | 2015-05-08 23:55:53 +0800 |
---|---|---|
committer | Daniel A. Nagy <nagy.da@gmail.com> | 2015-05-08 23:55:53 +0800 |
commit | 62dd9833ec768e2026bccb1cf7a8ef4263b9286d (patch) | |
tree | 0a091d99afd7f8cf5e3a6d4522c30ceef8559a55 /eth/downloader/peer.go | |
parent | 3a01e3e39b9ce83ecb7444319407ee8bb00e3bf6 (diff) | |
parent | c8fc4cebe63073fd77d5f553a4f0cec36a4ccb4b (diff) | |
download | dexon-62dd9833ec768e2026bccb1cf7a8ef4263b9286d.tar dexon-62dd9833ec768e2026bccb1cf7a8ef4263b9286d.tar.gz dexon-62dd9833ec768e2026bccb1cf7a8ef4263b9286d.tar.bz2 dexon-62dd9833ec768e2026bccb1cf7a8ef4263b9286d.tar.lz dexon-62dd9833ec768e2026bccb1cf7a8ef4263b9286d.tar.xz dexon-62dd9833ec768e2026bccb1cf7a8ef4263b9286d.tar.zst dexon-62dd9833ec768e2026bccb1cf7a8ef4263b9286d.zip |
Merge branch 'develop' of github.com:ethereum/go-ethereum into develop
Diffstat (limited to 'eth/downloader/peer.go')
-rw-r--r-- | eth/downloader/peer.go | 15 |
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 |