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
f56fc9cd
Commit
f56fc9cd
authored
Apr 01, 2015
by
zelig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change StatusMsgData.TD back to pointer type *big.Int
parent
6ffea34d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
protocol.go
eth/protocol.go
+3
-3
protocol_test.go
eth/protocol_test.go
+5
-5
No files found.
eth/protocol.go
View file @
f56fc9cd
...
...
@@ -105,7 +105,7 @@ type getBlockHashesMsgData struct {
type
statusMsgData
struct
{
ProtocolVersion
uint32
NetworkId
uint32
TD
big
.
Int
TD
*
big
.
Int
CurrentBlock
common
.
Hash
GenesisBlock
common
.
Hash
}
...
...
@@ -344,7 +344,7 @@ func (self *ethProtocol) handleStatus() error {
return
self
.
protoError
(
ErrProtocolVersionMismatch
,
"%d (!= %d)"
,
status
.
ProtocolVersion
,
self
.
protocolVersion
)
}
_
,
suspended
:=
self
.
blockPool
.
AddPeer
(
&
status
.
TD
,
status
.
CurrentBlock
,
self
.
id
,
self
.
requestBlockHashes
,
self
.
requestBlocks
,
self
.
protoErrorDisconnect
)
_
,
suspended
:=
self
.
blockPool
.
AddPeer
(
status
.
TD
,
status
.
CurrentBlock
,
self
.
id
,
self
.
requestBlockHashes
,
self
.
requestBlocks
,
self
.
protoErrorDisconnect
)
if
suspended
{
return
self
.
protoError
(
ErrSuspendedPeer
,
""
)
}
...
...
@@ -375,7 +375,7 @@ func (self *ethProtocol) sendStatus() error {
return
p2p
.
Send
(
self
.
rw
,
StatusMsg
,
&
statusMsgData
{
ProtocolVersion
:
uint32
(
self
.
protocolVersion
),
NetworkId
:
uint32
(
self
.
networkId
),
TD
:
*
td
,
TD
:
td
,
CurrentBlock
:
currentBlock
,
GenesisBlock
:
genesisBlock
,
})
...
...
eth/protocol_test.go
View file @
f56fc9cd
...
...
@@ -173,7 +173,7 @@ func (self *ethProtocolTester) handshake(t *testing.T, mock bool) {
err
:=
p2p
.
ExpectMsg
(
self
,
StatusMsg
,
&
statusMsgData
{
ProtocolVersion
:
ProtocolVersion
,
NetworkId
:
NetworkId
,
TD
:
*
td
,
TD
:
td
,
CurrentBlock
:
currentBlock
,
GenesisBlock
:
genesis
,
})
...
...
@@ -181,7 +181,7 @@ func (self *ethProtocolTester) handshake(t *testing.T, mock bool) {
t
.
Fatalf
(
"incorrect outgoing status: %v"
,
err
)
}
if
mock
{
go
p2p
.
Send
(
self
,
StatusMsg
,
&
statusMsgData
{
ProtocolVersion
,
NetworkId
,
*
td
,
currentBlock
,
genesis
})
go
p2p
.
Send
(
self
,
StatusMsg
,
&
statusMsgData
{
ProtocolVersion
,
NetworkId
,
td
,
currentBlock
,
genesis
})
}
}
...
...
@@ -201,15 +201,15 @@ func TestStatusMsgErrors(t *testing.T) {
wantErrorCode
:
ErrNoStatusMsg
,
},
{
code
:
StatusMsg
,
data
:
statusMsgData
{
10
,
NetworkId
,
*
td
,
currentBlock
,
genesis
},
code
:
StatusMsg
,
data
:
statusMsgData
{
10
,
NetworkId
,
td
,
currentBlock
,
genesis
},
wantErrorCode
:
ErrProtocolVersionMismatch
,
},
{
code
:
StatusMsg
,
data
:
statusMsgData
{
ProtocolVersion
,
999
,
*
td
,
currentBlock
,
genesis
},
code
:
StatusMsg
,
data
:
statusMsgData
{
ProtocolVersion
,
999
,
td
,
currentBlock
,
genesis
},
wantErrorCode
:
ErrNetworkIdMismatch
,
},
{
code
:
StatusMsg
,
data
:
statusMsgData
{
ProtocolVersion
,
NetworkId
,
*
td
,
currentBlock
,
common
.
Hash
{
3
}},
code
:
StatusMsg
,
data
:
statusMsgData
{
ProtocolVersion
,
NetworkId
,
td
,
currentBlock
,
common
.
Hash
{
3
}},
wantErrorCode
:
ErrGenesisBlockMismatch
,
},
}
...
...
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