aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/peer.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-24 21:36:48 +0800
committerobscuren <geffobscura@gmail.com>2015-04-24 21:37:07 +0800
commitbd9c76097d485b55ae808fee345d1d76801df1ea (patch)
treea6a641cc5c9af103f1a5eaa7d86d3ec1cfe6c345 /eth/downloader/peer.go
parent31f82eb3347454f64f3d41de3087109d09597806 (diff)
downloaddexon-bd9c76097d485b55ae808fee345d1d76801df1ea.tar
dexon-bd9c76097d485b55ae808fee345d1d76801df1ea.tar.gz
dexon-bd9c76097d485b55ae808fee345d1d76801df1ea.tar.bz2
dexon-bd9c76097d485b55ae808fee345d1d76801df1ea.tar.lz
dexon-bd9c76097d485b55ae808fee345d1d76801df1ea.tar.xz
dexon-bd9c76097d485b55ae808fee345d1d76801df1ea.tar.zst
dexon-bd9c76097d485b55ae808fee345d1d76801df1ea.zip
eth/downloader: removed peer td management and best peer selection
Diffstat (limited to 'eth/downloader/peer.go')
-rw-r--r--eth/downloader/peer.go15
1 files changed, 1 insertions, 14 deletions
diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go
index bcb8ad43a..91977f592 100644
--- a/eth/downloader/peer.go
+++ b/eth/downloader/peer.go
@@ -2,7 +2,6 @@ package downloader
import (
"errors"
- "math/big"
"sync"
"github.com/ethereum/go-ethereum/common"
@@ -51,16 +50,6 @@ func (p peers) getPeer(id string) *peer {
return p[id]
}
-func (p peers) bestPeer() *peer {
- var peer *peer
- for _, cp := range p {
- if peer == nil || cp.td.Cmp(peer.td) > 0 {
- peer = cp
- }
- }
- return peer
-}
-
// peer represents an active peer
type peer struct {
state int // Peer state (working, idle)
@@ -68,7 +57,6 @@ type peer struct {
mu sync.RWMutex
id string
- td *big.Int
recentHash common.Hash
ignored *set.Set
@@ -78,10 +66,9 @@ type peer struct {
}
// create a new peer
-func newPeer(id string, td *big.Int, hash common.Hash, getHashes hashFetcherFn, getBlocks blockFetcherFn) *peer {
+func newPeer(id string, hash common.Hash, getHashes hashFetcherFn, getBlocks blockFetcherFn) *peer {
return &peer{
id: id,
- td: td,
recentHash: hash,
getHashes: getHashes,
getBlocks: getBlocks,