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
0fe66f8a
Unverified
Commit
0fe66f8a
authored
Dec 14, 2020
by
Mr-Leshiy
Committed by
GitHub
Dec 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/protocols/eth: remove magic numbers in test (#21999)
parent
48599297
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
handler_test.go
eth/protocols/eth/handler_test.go
+11
-11
No files found.
eth/protocols/eth/handler_test.go
View file @
0fe66f8a
...
...
@@ -254,8 +254,8 @@ func testGetBlockHeaders(t *testing.T, protocol uint) {
headers
=
append
(
headers
,
backend
.
chain
.
GetBlockByHash
(
hash
)
.
Header
())
}
// Send the hash request and verify the response
p2p
.
Send
(
peer
.
app
,
0x03
,
tt
.
query
)
if
err
:=
p2p
.
ExpectMsg
(
peer
.
app
,
0x04
,
headers
);
err
!=
nil
{
p2p
.
Send
(
peer
.
app
,
GetBlockHeadersMsg
,
tt
.
query
)
if
err
:=
p2p
.
ExpectMsg
(
peer
.
app
,
BlockHeadersMsg
,
headers
);
err
!=
nil
{
t
.
Errorf
(
"test %d: headers mismatch: %v"
,
i
,
err
)
}
// If the test used number origins, repeat with hashes as the too
...
...
@@ -263,8 +263,8 @@ func testGetBlockHeaders(t *testing.T, protocol uint) {
if
origin
:=
backend
.
chain
.
GetBlockByNumber
(
tt
.
query
.
Origin
.
Number
);
origin
!=
nil
{
tt
.
query
.
Origin
.
Hash
,
tt
.
query
.
Origin
.
Number
=
origin
.
Hash
(),
0
p2p
.
Send
(
peer
.
app
,
0x03
,
tt
.
query
)
if
err
:=
p2p
.
ExpectMsg
(
peer
.
app
,
0x04
,
headers
);
err
!=
nil
{
p2p
.
Send
(
peer
.
app
,
GetBlockHeadersMsg
,
tt
.
query
)
if
err
:=
p2p
.
ExpectMsg
(
peer
.
app
,
BlockHeadersMsg
,
headers
);
err
!=
nil
{
t
.
Errorf
(
"test %d: headers mismatch: %v"
,
i
,
err
)
}
}
...
...
@@ -343,8 +343,8 @@ func testGetBlockBodies(t *testing.T, protocol uint) {
}
}
// Send the hash request and verify the response
p2p
.
Send
(
peer
.
app
,
0x05
,
hashes
)
if
err
:=
p2p
.
ExpectMsg
(
peer
.
app
,
0x06
,
bodies
);
err
!=
nil
{
p2p
.
Send
(
peer
.
app
,
GetBlockBodiesMsg
,
hashes
)
if
err
:=
p2p
.
ExpectMsg
(
peer
.
app
,
BlockBodiesMsg
,
bodies
);
err
!=
nil
{
t
.
Errorf
(
"test %d: bodies mismatch: %v"
,
i
,
err
)
}
}
...
...
@@ -410,13 +410,13 @@ func testGetNodeData(t *testing.T, protocol uint) {
}
it
.
Release
()
p2p
.
Send
(
peer
.
app
,
0x0d
,
hashes
)
p2p
.
Send
(
peer
.
app
,
GetNodeDataMsg
,
hashes
)
msg
,
err
:=
peer
.
app
.
ReadMsg
()
if
err
!=
nil
{
t
.
Fatalf
(
"failed to read node data response: %v"
,
err
)
}
if
msg
.
Code
!=
0x0e
{
t
.
Fatalf
(
"response packet code mismatch: have %x, want %x"
,
msg
.
Code
,
0x0c
)
if
msg
.
Code
!=
NodeDataMsg
{
t
.
Fatalf
(
"response packet code mismatch: have %x, want %x"
,
msg
.
Code
,
NodeDataMsg
)
}
var
data
[][]
byte
if
err
:=
msg
.
Decode
(
&
data
);
err
!=
nil
{
...
...
@@ -512,8 +512,8 @@ func testGetBlockReceipts(t *testing.T, protocol uint) {
receipts
=
append
(
receipts
,
backend
.
chain
.
GetReceiptsByHash
(
block
.
Hash
()))
}
// Send the hash request and verify the response
p2p
.
Send
(
peer
.
app
,
0x0f
,
hashes
)
if
err
:=
p2p
.
ExpectMsg
(
peer
.
app
,
0x10
,
receipts
);
err
!=
nil
{
p2p
.
Send
(
peer
.
app
,
GetReceiptsMsg
,
hashes
)
if
err
:=
p2p
.
ExpectMsg
(
peer
.
app
,
ReceiptsMsg
,
receipts
);
err
!=
nil
{
t
.
Errorf
(
"receipts mismatch: %v"
,
err
)
}
}
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