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
9ed5b4d9
Commit
9ed5b4d9
authored
Sep 22, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support C++ GetBlockHash by assuming empty = done
parent
b65f29f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
peer.go
peer.go
+14
-12
No files found.
peer.go
View file @
9ed5b4d9
...
@@ -362,22 +362,24 @@ clean:
...
@@ -362,22 +362,24 @@ clean:
}
}
func
formatMessage
(
msg
*
ethwire
.
Msg
)
(
ret
string
)
{
func
formatMessage
(
msg
*
ethwire
.
Msg
)
(
ret
string
)
{
ret
=
fmt
.
Sprintf
(
"%v
"
,
msg
.
Type
)
ret
=
fmt
.
Sprintf
(
"%v
%v"
,
msg
.
Type
,
msg
.
Data
)
/*
/*
XXX Commented out because I need the log level here to determine
XXX Commented out because I need the log level here to determine
if i should or shouldn't generate this message
if i should or shouldn't generate this message
*/
*/
switch
msg
.
Type
{
/*
case
ethwire
.
MsgPeersTy
:
switch msg.Type {
ret
+=
fmt
.
Sprintf
(
"(%d entries)"
,
msg
.
Data
.
Len
())
case ethwire.MsgPeersTy:
case
ethwire
.
MsgBlockTy
:
ret += fmt.Sprintf("(%d entries)", msg.Data.Len())
b1
,
b2
:=
ethchain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
0
)),
ethchain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
msg
.
Data
.
Len
()
-
1
))
case ethwire.MsgBlockTy:
ret
+=
fmt
.
Sprintf
(
"(%d entries) %x - %x"
,
msg
.
Data
.
Len
(),
b1
.
Hash
()[
0
:
4
],
b2
.
Hash
()[
0
:
4
])
b1, b2 := ethchain.NewBlockFromRlpValue(msg.Data.Get(0)), ethchain.NewBlockFromRlpValue(msg.Data.Get(msg.Data.Len()-1))
case
ethwire
.
MsgBlockHashesTy
:
ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), b1.Hash()[0:4], b2.Hash()[0:4])
h1
,
h2
:=
msg
.
Data
.
Get
(
0
)
.
Bytes
(),
msg
.
Data
.
Get
(
msg
.
Data
.
Len
()
-
1
)
.
Bytes
()
case ethwire.MsgBlockHashesTy:
ret
+=
fmt
.
Sprintf
(
"(%d entries) %x - %x"
,
msg
.
Data
.
Len
(),
h1
[
0
:
4
],
h2
[
0
:
4
])
h1, h2 := msg.Data.Get(0).Bytes(), msg.Data.Get(msg.Data.Len()-1).Bytes()
}
ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), h1, h2)
}
*/
return
return
}
}
...
@@ -512,7 +514,7 @@ func (p *Peer) HandleInbound() {
...
@@ -512,7 +514,7 @@ func (p *Peer) HandleInbound() {
p
.
lastBlockReceived
=
time
.
Now
()
p
.
lastBlockReceived
=
time
.
Now
()
}
}
if
foundCommonHash
{
if
foundCommonHash
||
msg
.
Data
.
Len
()
==
0
{
p
.
FetchBlocks
()
p
.
FetchBlocks
()
}
else
{
}
else
{
p
.
FetchHashes
()
p
.
FetchHashes
()
...
...
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