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
86d1a26b
Commit
86d1a26b
authored
Sep 14, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed status message
parent
742a9b00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
peer.go
peer.go
+19
-9
No files found.
peer.go
View file @
86d1a26b
...
@@ -634,8 +634,8 @@ func (self *Peer) pushStatus() {
...
@@ -634,8 +634,8 @@ func (self *Peer) pushStatus() {
const
netVersion
=
0
const
netVersion
=
0
msg
:=
ethwire
.
NewMessage
(
ethwire
.
MsgStatusTy
,
[]
interface
{}{
msg
:=
ethwire
.
NewMessage
(
ethwire
.
MsgStatusTy
,
[]
interface
{}{
uint32
(
ProtocolVersion
),
uint32
(
ProtocolVersion
),
netVersion
,
uint32
(
netVersion
)
,
self
.
ethereum
.
BlockChain
()
.
TD
.
Uint64
()
,
self
.
ethereum
.
BlockChain
()
.
TD
,
self
.
ethereum
.
BlockChain
()
.
CurrentBlock
.
Hash
(),
self
.
ethereum
.
BlockChain
()
.
CurrentBlock
.
Hash
(),
self
.
ethereum
.
BlockChain
()
.
Genesis
()
.
Hash
(),
self
.
ethereum
.
BlockChain
()
.
Genesis
()
.
Hash
(),
})
})
...
@@ -645,13 +645,22 @@ func (self *Peer) pushStatus() {
...
@@ -645,13 +645,22 @@ func (self *Peer) pushStatus() {
func
(
self
*
Peer
)
handleStatus
(
msg
*
ethwire
.
Msg
)
{
func
(
self
*
Peer
)
handleStatus
(
msg
*
ethwire
.
Msg
)
{
c
:=
msg
.
Data
c
:=
msg
.
Data
// Set the peer's caps
//p.caps = Caps(c.Get(3).Byte())
var
(
protoVersion
=
c
.
Get
(
0
)
.
Uint
()
netVersion
=
c
.
Get
(
1
)
.
Uint
()
td
=
c
.
Get
(
2
)
.
BigInt
()
bestHash
=
c
.
Get
(
3
)
.
Bytes
()
genesis
=
c
.
Get
(
4
)
.
Bytes
()
)
ethlogger
.
Infof
(
"gen = %x
\n
"
,
genesis
)
// Get the td and last hash
// Get the td and last hash
self
.
td
=
c
.
Get
(
6
)
.
BigInt
()
self
.
td
=
td
self
.
bestHash
=
c
.
Get
(
7
)
.
Bytes
()
self
.
bestHash
=
bestHash
self
.
lastReceivedHash
=
self
.
bestHash
self
.
lastReceivedHash
=
bestHash
self
.
statusKnown
=
true
// Compare the total TD with the blockchain TD. If remote is higher
// Compare the total TD with the blockchain TD. If remote is higher
// fetch hashes from highest TD node.
// fetch hashes from highest TD node.
...
@@ -660,13 +669,14 @@ func (self *Peer) handleStatus(msg *ethwire.Msg) {
...
@@ -660,13 +669,14 @@ func (self *Peer) handleStatus(msg *ethwire.Msg) {
self
.
FetchHashes
()
self
.
FetchHashes
()
}
}
ethlogger
.
Infof
(
"Peer is [ETH] capable. (TD = %v ~ %x"
,
self
.
td
,
self
.
bestHash
)
ethlogger
.
Infof
(
"Peer is [ETH] capable. (TD = %v ~ %x) %d / %d"
,
self
.
td
,
self
.
bestHash
,
protoVersion
,
netVersion
)
}
}
func
(
p
*
Peer
)
pushHandshake
()
error
{
func
(
p
*
Peer
)
pushHandshake
()
error
{
pubkey
:=
p
.
ethereum
.
KeyManager
()
.
PublicKey
()
pubkey
:=
p
.
ethereum
.
KeyManager
()
.
PublicKey
()
msg
:=
ethwire
.
NewMessage
(
ethwire
.
MsgHandshakeTy
,
[]
interface
{}{
msg
:=
ethwire
.
NewMessage
(
ethwire
.
MsgHandshakeTy
,
[]
interface
{}{
uint32
(
0
),
[]
byte
(
p
.
version
),
[]
string
{
"eth"
},
uint32
(
30303
)
/*p.port*/
,
pubkey
[
1
:
],
P2PVersion
,
[]
byte
(
p
.
version
),
[]
interface
{}
{
"eth"
},
uint32
(
30303
)
/*p.port*/
,
pubkey
[
1
:
],
})
})
p
.
QueueMessage
(
msg
)
p
.
QueueMessage
(
msg
)
...
...
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