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
ca88e18f
Commit
ca88e18f
authored
9 years ago
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: kill off protocol eth/60 in preparation for eth/62
parent
42f44dda
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
804 deletions
+28
-804
downloader.go
eth/downloader/downloader.go
+3
-394
downloader_test.go
eth/downloader/downloader_test.go
+2
-378
handler_test.go
eth/handler_test.go
+0
-3
metrics.go
eth/metrics.go
+12
-12
protocol.go
eth/protocol.go
+11
-14
protocol_test.go
eth/protocol_test.go
+0
-3
No files found.
eth/downloader/downloader.go
View file @
ca88e18f
This diff is collapsed.
Click to expand it.
eth/downloader/downloader_test.go
View file @
ca88e18f
This diff is collapsed.
Click to expand it.
eth/handler_test.go
View file @
ca88e18f
...
...
@@ -19,7 +19,6 @@ import (
// Tests that hashes can be retrieved from a remote chain by hashes in reverse
// order.
func
TestGetBlockHashes60
(
t
*
testing
.
T
)
{
testGetBlockHashes
(
t
,
60
)
}
func
TestGetBlockHashes61
(
t
*
testing
.
T
)
{
testGetBlockHashes
(
t
,
61
)
}
func
testGetBlockHashes
(
t
*
testing
.
T
,
protocol
int
)
{
...
...
@@ -63,7 +62,6 @@ func testGetBlockHashes(t *testing.T, protocol int) {
// Tests that hashes can be retrieved from a remote chain by numbers in forward
// order.
func
TestGetBlockHashesFromNumber60
(
t
*
testing
.
T
)
{
testGetBlockHashesFromNumber
(
t
,
60
)
}
func
TestGetBlockHashesFromNumber61
(
t
*
testing
.
T
)
{
testGetBlockHashesFromNumber
(
t
,
61
)
}
func
testGetBlockHashesFromNumber
(
t
*
testing
.
T
,
protocol
int
)
{
...
...
@@ -104,7 +102,6 @@ func testGetBlockHashesFromNumber(t *testing.T, protocol int) {
}
// Tests that blocks can be retrieved from a remote chain based on their hashes.
func
TestGetBlocks60
(
t
*
testing
.
T
)
{
testGetBlocks
(
t
,
60
)
}
func
TestGetBlocks61
(
t
*
testing
.
T
)
{
testGetBlocks
(
t
,
61
)
}
func
testGetBlocks
(
t
*
testing
.
T
,
protocol
int
)
{
...
...
This diff is collapsed.
Click to expand it.
eth/metrics.go
View file @
ca88e18f
...
...
@@ -95,19 +95,19 @@ func (rw *meteredMsgReadWriter) ReadMsg() (p2p.Msg, error) {
// Account for the data traffic
packets
,
traffic
:=
miscInPacketsMeter
,
miscInTrafficMeter
switch
{
case
(
rw
.
version
==
eth60
||
rw
.
version
==
eth61
)
&&
msg
.
Code
==
BlockHashesMsg
:
case
rw
.
version
<
eth62
&&
msg
.
Code
==
BlockHashesMsg
:
packets
,
traffic
=
reqHashInPacketsMeter
,
reqHashInTrafficMeter
case
(
rw
.
version
==
eth60
||
rw
.
version
==
eth61
)
&&
msg
.
Code
==
BlocksMsg
:
case
rw
.
version
<
eth62
&&
msg
.
Code
==
BlocksMsg
:
packets
,
traffic
=
reqBlockInPacketsMeter
,
reqBlockInTrafficMeter
case
rw
.
version
=
=
eth62
&&
msg
.
Code
==
BlockHeadersMsg
:
case
rw
.
version
>
=
eth62
&&
msg
.
Code
==
BlockHeadersMsg
:
packets
,
traffic
=
reqBlockInPacketsMeter
,
reqBlockInTrafficMeter
case
rw
.
version
=
=
eth62
&&
msg
.
Code
==
BlockBodiesMsg
:
case
rw
.
version
>
=
eth62
&&
msg
.
Code
==
BlockBodiesMsg
:
packets
,
traffic
=
reqBodyInPacketsMeter
,
reqBodyInTrafficMeter
case
rw
.
version
=
=
eth63
&&
msg
.
Code
==
NodeDataMsg
:
case
rw
.
version
>
=
eth63
&&
msg
.
Code
==
NodeDataMsg
:
packets
,
traffic
=
reqStateInPacketsMeter
,
reqStateInTrafficMeter
case
rw
.
version
=
=
eth63
&&
msg
.
Code
==
ReceiptsMsg
:
case
rw
.
version
>
=
eth63
&&
msg
.
Code
==
ReceiptsMsg
:
packets
,
traffic
=
reqReceiptInPacketsMeter
,
reqReceiptInTrafficMeter
case
msg
.
Code
==
NewBlockHashesMsg
:
...
...
@@ -127,19 +127,19 @@ func (rw *meteredMsgReadWriter) WriteMsg(msg p2p.Msg) error {
// Account for the data traffic
packets
,
traffic
:=
miscOutPacketsMeter
,
miscOutTrafficMeter
switch
{
case
(
rw
.
version
==
eth60
||
rw
.
version
==
eth61
)
&&
msg
.
Code
==
BlockHashesMsg
:
case
rw
.
version
<
eth62
&&
msg
.
Code
==
BlockHashesMsg
:
packets
,
traffic
=
reqHashOutPacketsMeter
,
reqHashOutTrafficMeter
case
(
rw
.
version
==
eth60
||
rw
.
version
==
eth61
)
&&
msg
.
Code
==
BlocksMsg
:
case
rw
.
version
<
eth62
&&
msg
.
Code
==
BlocksMsg
:
packets
,
traffic
=
reqBlockOutPacketsMeter
,
reqBlockOutTrafficMeter
case
rw
.
version
=
=
eth62
&&
msg
.
Code
==
BlockHeadersMsg
:
case
rw
.
version
>
=
eth62
&&
msg
.
Code
==
BlockHeadersMsg
:
packets
,
traffic
=
reqHeaderOutPacketsMeter
,
reqHeaderOutTrafficMeter
case
rw
.
version
=
=
eth62
&&
msg
.
Code
==
BlockBodiesMsg
:
case
rw
.
version
>
=
eth62
&&
msg
.
Code
==
BlockBodiesMsg
:
packets
,
traffic
=
reqBodyOutPacketsMeter
,
reqBodyOutTrafficMeter
case
rw
.
version
=
=
eth63
&&
msg
.
Code
==
NodeDataMsg
:
case
rw
.
version
>
=
eth63
&&
msg
.
Code
==
NodeDataMsg
:
packets
,
traffic
=
reqStateOutPacketsMeter
,
reqStateOutTrafficMeter
case
rw
.
version
=
=
eth63
&&
msg
.
Code
==
ReceiptsMsg
:
case
rw
.
version
>
=
eth63
&&
msg
.
Code
==
ReceiptsMsg
:
packets
,
traffic
=
reqReceiptOutPacketsMeter
,
reqReceiptOutTrafficMeter
case
msg
.
Code
==
NewBlockHashesMsg
:
...
...
This diff is collapsed.
Click to expand it.
eth/protocol.go
View file @
ca88e18f
...
...
@@ -28,7 +28,6 @@ import (
// Constants to match up protocol versions and messages
const
(
eth60
=
60
eth61
=
61
eth62
=
62
eth63
=
63
...
...
@@ -36,10 +35,10 @@ const (
)
// Supported versions of the eth protocol (first is primary).
var
ProtocolVersions
=
[]
uint
{
eth64
,
eth63
,
eth62
,
eth61
,
eth60
}
var
ProtocolVersions
=
[]
uint
{
eth64
,
eth63
,
eth62
,
eth61
}
// Number of implemented message corresponding to different protocol versions.
var
ProtocolLengths
=
[]
uint64
{
15
,
12
,
8
,
9
,
8
}
var
ProtocolLengths
=
[]
uint64
{
15
,
12
,
8
,
9
}
const
(
NetworkId
=
1
...
...
@@ -48,17 +47,15 @@ const (
// eth protocol message codes
const
(
// Protocol messages belonging to eth/60
StatusMsg
=
0x00
NewBlockHashesMsg
=
0x01
TxMsg
=
0x02
GetBlockHashesMsg
=
0x03
BlockHashesMsg
=
0x04
GetBlocksMsg
=
0x05
BlocksMsg
=
0x06
NewBlockMsg
=
0x07
// Protocol messages belonging to eth/61 (extension of eth/60)
// Protocol messages belonging to eth/61
StatusMsg
=
0x00
NewBlockHashesMsg
=
0x01
TxMsg
=
0x02
GetBlockHashesMsg
=
0x03
BlockHashesMsg
=
0x04
GetBlocksMsg
=
0x05
BlocksMsg
=
0x06
NewBlockMsg
=
0x07
GetBlockHashesFromNumberMsg
=
0x08
// Protocol messages belonging to eth/62 (new protocol from scratch)
...
...
This diff is collapsed.
Click to expand it.
eth/protocol_test.go
View file @
ca88e18f
...
...
@@ -38,7 +38,6 @@ func init() {
var
testAccount
=
crypto
.
NewKey
(
rand
.
Reader
)
// Tests that handshake failures are detected and reported correctly.
func
TestStatusMsgErrors60
(
t
*
testing
.
T
)
{
testStatusMsgErrors
(
t
,
60
)
}
func
TestStatusMsgErrors61
(
t
*
testing
.
T
)
{
testStatusMsgErrors
(
t
,
61
)
}
func
TestStatusMsgErrors62
(
t
*
testing
.
T
)
{
testStatusMsgErrors
(
t
,
62
)
}
func
TestStatusMsgErrors63
(
t
*
testing
.
T
)
{
testStatusMsgErrors
(
t
,
63
)
}
...
...
@@ -93,7 +92,6 @@ func testStatusMsgErrors(t *testing.T, protocol int) {
}
// This test checks that received transactions are added to the local pool.
func
TestRecvTransactions60
(
t
*
testing
.
T
)
{
testRecvTransactions
(
t
,
60
)
}
func
TestRecvTransactions61
(
t
*
testing
.
T
)
{
testRecvTransactions
(
t
,
61
)
}
func
TestRecvTransactions62
(
t
*
testing
.
T
)
{
testRecvTransactions
(
t
,
62
)
}
func
TestRecvTransactions63
(
t
*
testing
.
T
)
{
testRecvTransactions
(
t
,
63
)
}
...
...
@@ -123,7 +121,6 @@ func testRecvTransactions(t *testing.T, protocol int) {
}
// This test checks that pending transactions are sent.
func
TestSendTransactions60
(
t
*
testing
.
T
)
{
testSendTransactions
(
t
,
60
)
}
func
TestSendTransactions61
(
t
*
testing
.
T
)
{
testSendTransactions
(
t
,
61
)
}
func
TestSendTransactions62
(
t
*
testing
.
T
)
{
testSendTransactions
(
t
,
62
)
}
func
TestSendTransactions63
(
t
*
testing
.
T
)
{
testSendTransactions
(
t
,
63
)
}
...
...
This diff is collapsed.
Click to expand it.
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