From 47f62a67aa8a033d8a81dc16104018369325897d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 2 Oct 2015 13:20:41 +0300 Subject: eth/downloader: match capabilities when querying idle peers --- eth/downloader/peer.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'eth/downloader/peer.go') 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++ { -- cgit v1.2.3