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
9350ecd3
Commit
9350ecd3
authored
Jun 23, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not keep on asking for the same chain
parent
8c96c566
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
peer.go
peer.go
+8
-0
No files found.
peer.go
View file @
9350ecd3
...
...
@@ -138,6 +138,8 @@ type Peer struct {
// We use this to give some kind of pingtime to a node, not very accurate, could be improved.
pingTime
time
.
Duration
pingStartTime
time
.
Time
lastRequestedBlock
*
ethchain
.
Block
}
func
NewPeer
(
conn
net
.
Conn
,
ethereum
*
Ethereum
,
inbound
bool
)
*
Peer
{
...
...
@@ -351,6 +353,12 @@ func (p *Peer) HandleInbound() {
// We requested blocks and now we need to make sure we have a common ancestor somewhere in these blocks so we can find
// common ground to start syncing from
lastBlock
=
ethchain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
msg
.
Data
.
Len
()
-
1
))
if
p
.
lastRequestedBlock
!=
nil
&&
bytes
.
Compare
(
lastBlock
.
Hash
(),
p
.
lastRequestedBlock
.
Hash
())
==
0
{
p
.
catchingUp
=
false
continue
}
p
.
lastRequestedBlock
=
lastBlock
ethutil
.
Config
.
Log
.
Infof
(
"[PEER] Last block: %x. Checking if we have it locally.
\n
"
,
lastBlock
.
Hash
())
for
i
:=
msg
.
Data
.
Len
()
-
1
;
i
>=
0
;
i
--
{
block
=
ethchain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
i
))
...
...
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