Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
bd9c7609
Commit
bd9c7609
authored
Apr 24, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/downloader: removed peer td management and best peer selection
parent
31f82eb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
16 deletions
+2
-16
peer.go
eth/downloader/peer.go
+1
-14
queue.go
eth/downloader/queue.go
+1
-2
No files found.
eth/downloader/peer.go
View file @
bd9c7609
...
...
@@ -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
,
...
...
eth/downloader/queue.go
View file @
bd9c7609
...
...
@@ -2,7 +2,6 @@ package downloader
import
(
"math"
"math/big"
"sync"
"time"
...
...
@@ -93,7 +92,7 @@ func (c *queue) has(hash common.Hash) bool {
return
c
.
hashPool
.
Has
(
hash
)
||
c
.
fetchPool
.
Has
(
hash
)
}
func
(
c
*
queue
)
addBlock
(
id
string
,
block
*
types
.
Block
,
td
*
big
.
Int
)
{
func
(
c
*
queue
)
addBlock
(
id
string
,
block
*
types
.
Block
)
{
c
.
mu
.
Lock
()
defer
c
.
mu
.
Unlock
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment