aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/peer.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-10-02 18:49:56 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-10-02 18:49:56 +0800
commit8b865fa9bf75e728d5d76f5a1460e0c37d8b5f9e (patch)
tree5d6b574b18a8cf919ed4d0142e90340184c060c5 /eth/downloader/peer.go
parent0d78f96205685e56ff20f99859538437939950f3 (diff)
parent47f62a67aa8a033d8a81dc16104018369325897d (diff)
downloaddexon-8b865fa9bf75e728d5d76f5a1460e0c37d8b5f9e.tar.gz
dexon-8b865fa9bf75e728d5d76f5a1460e0c37d8b5f9e.tar.zst
dexon-8b865fa9bf75e728d5d76f5a1460e0c37d8b5f9e.zip
Merge pull request #1866 from karalabe/honor-eth-capabilities
eth/downloader: match capabilities when querying idle peers
Diffstat (limited to 'eth/downloader/peer.go')
-rw-r--r--eth/downloader/peer.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go
index 8fd1f9a99..c1d20ac61 100644
--- a/eth/downloader/peer.go
+++ b/eth/downloader/peer.go
@@ -312,14 +312,16 @@ func (ps *peerSet) AllPeers() []*peer {
// IdlePeers retrieves a flat list of all the currently idle peers within the
// active peer set, ordered by their reputation.
-func (ps *peerSet) IdlePeers() []*peer {
+func (ps *peerSet) IdlePeers(version int) []*peer {
ps.lock.RLock()
defer ps.lock.RUnlock()
list := make([]*peer, 0, len(ps.peers))
for _, p := range ps.peers {
- if atomic.LoadInt32(&p.idle) == 0 {
- list = append(list, p)
+ if (version == eth61 && p.version == eth61) || (version >= eth62 && p.version >= eth62) {
+ if atomic.LoadInt32(&p.idle) == 0 {
+ list = append(list, p)
+ }
}
}
for i := 0; i < len(list); i++ {