good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
bd9c7609
Commit
bd9c7609
authored
10 years ago
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
eth/downloader: removed peer td management and best peer selection
parent
31f82eb3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
eth/downloader/peer.go
+1
-14
1 addition, 14 deletions
eth/downloader/peer.go
eth/downloader/queue.go
+1
-2
1 addition, 2 deletions
eth/downloader/queue.go
with
2 additions
and
16 deletions
eth/downloader/peer.go
+
1
−
14
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
,
...
...
This diff is collapsed.
Click to expand it.
eth/downloader/queue.go
+
1
−
2
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
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment