Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
af9da83c
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
af9da83c
编写于
3月 18, 2015
作者:
O
obscuren
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into rpcfrontier
上级
e30c3233
c12046d6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
126 addition
and
106 deletion
+126
-106
Dockerfile
Dockerfile
+3
-4
cmd/ethereum/main.go
cmd/ethereum/main.go
+25
-4
cmd/mist/main.go
cmd/mist/main.go
+3
-1
cmd/utils/flags.go
cmd/utils/flags.go
+41
-30
eth/backend.go
eth/backend.go
+25
-19
eth/peer_util.go
eth/peer_util.go
+0
-23
eth/protocol.go
eth/protocol.go
+27
-23
eth/protocol_test.go
eth/protocol_test.go
+2
-2
未找到文件。
Dockerfile
浏览文件 @
af9da83c
...
...
@@ -26,12 +26,11 @@ RUN tar -C /usr/local -xzf go*.tar.gz && go version
ADD
https://api.github.com/repos/ethereum/go-ethereum/git/refs/heads/develop file_does_not_exist
## Fetch and install go-ethereum
RUN
go get github.com/tools/godep
RUN
g
o get
-d
github.com/ethereum/go-ethereum/...
RUN
mkdir
-p
$GOPATH
/src/github.com/ethereum/
RUN
g
it clone https://github.com/ethereum/go-ethereum
$GOPATH
/src/github.com/ethereum/go-ethereum
WORKDIR
$GOPATH/src/github.com/ethereum/go-ethereum
RUN
git checkout develop
RUN
godep restore
RUN
go
install
-v
./cmd/ethereum
RUN
GOPATH
=
$GOPATH
:
$GOPATH
/src/github.com/ethereum/go-ethereum/Godeps/_workspace go
install
-v
./cmd/ethereum
## Run & expose JSON RPC
ENTRYPOINT
["ethereum", "-rpc=true", "-rpcport=8545"]
...
...
cmd/ethereum/main.go
浏览文件 @
af9da83c
...
...
@@ -30,6 +30,7 @@ import (
"time"
"github.com/codegangsta/cli"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
...
...
@@ -41,7 +42,7 @@ import (
const
(
ClientIdentifier
=
"Ethereum(G)"
Version
=
"0.9.1"
Version
=
"
Frontier -
0.9.1"
)
var
(
...
...
@@ -54,6 +55,17 @@ func init() {
app
.
HideVersion
=
true
// we have a command to print the version
app
.
Commands
=
[]
cli
.
Command
{
blocktestCmd
,
{
Action
:
makedag
,
Name
:
"makedag"
,
Usage
:
"generate ethash dag (for testing)"
,
Description
:
`
The makedag command generates an ethash DAG in /tmp/dag.
This command exists to support the system testing project.
Regular users do not need to execute it.
`
,
},
{
Action
:
version
,
Name
:
"version"
,
...
...
@@ -136,8 +148,8 @@ The Ethereum JavaScript VM exposes a node admin interface as well as the DAPP Ja
utils
.
RPCPortFlag
,
utils
.
UnencryptedKeysFlag
,
utils
.
VMDebugFlag
,
//utils.VMType
Flag,
utils
.
ProtocolVersionFlag
,
utils
.
NetworkId
Flag
,
}
// missing:
...
...
@@ -318,6 +330,15 @@ func dump(ctx *cli.Context) {
}
}
func
makedag
(
ctx
*
cli
.
Context
)
{
chain
,
_
,
_
:=
utils
.
GetChain
(
ctx
)
pow
:=
ethash
.
New
(
chain
)
fmt
.
Println
(
"making cache"
)
pow
.
UpdateCache
(
true
)
fmt
.
Println
(
"making DAG"
)
pow
.
UpdateDAG
()
}
func
version
(
c
*
cli
.
Context
)
{
fmt
.
Printf
(
`%v
Version: %v
...
...
@@ -327,7 +348,7 @@ GO: %s
OS: %s
GOPATH=%s
GOROOT=%s
`
,
ClientIdentifier
,
Version
,
eth
.
ProtocolVersion
,
eth
.
NetworkId
,
runtime
.
Version
(),
runtime
.
GOOS
,
os
.
Getenv
(
"GOPATH"
),
runtime
.
GOROOT
())
`
,
ClientIdentifier
,
Version
,
c
.
GlobalInt
(
utils
.
ProtocolVersionFlag
.
Name
),
c
.
GlobalInt
(
utils
.
NetworkIdFlag
.
Name
)
,
runtime
.
Version
(),
runtime
.
GOOS
,
os
.
Getenv
(
"GOPATH"
),
runtime
.
GOROOT
())
}
// hashish returns true for strings that look like hashes.
...
...
cmd/mist/main.go
浏览文件 @
af9da83c
...
...
@@ -28,8 +28,8 @@ import (
"github.com/codegangsta/cli"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/ui/qt/webengine"
"github.com/obscuren/qml"
...
...
@@ -66,6 +66,8 @@ func init() {
utils
.
RPCListenAddrFlag
,
utils
.
RPCPortFlag
,
utils
.
JSpathFlag
,
utils
.
ProtocolVersionFlag
,
utils
.
NetworkIdFlag
,
}
}
...
...
cmd/utils/flags.go
浏览文件 @
af9da83c
...
...
@@ -11,11 +11,11 @@ import (
"github.com/codegangsta/cli"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p/nat"
...
...
@@ -70,25 +70,23 @@ func NewApp(version, usage string) *cli.App {
var
(
// General settings
/*
VMTypeFlag = cli.IntFlag{
Name: "vm",
Usage: "Virtual Machine type: 0 is standard VM, 1 is debug VM",
}
*/
UnlockedAccountFlag
=
cli
.
StringFlag
{
Name
:
"unlock"
,
Usage
:
"Unlock a given account untill this programs exits (address:password)"
,
}
VMDebugFlag
=
cli
.
BoolFlag
{
Name
:
"vmdebug"
,
Usage
:
"Virtual Machine debug output"
,
}
DataDirFlag
=
cli
.
StringFlag
{
Name
:
"datadir"
,
Usage
:
"Data directory to be used"
,
Value
:
common
.
DefaultDataDir
(),
}
ProtocolVersionFlag
=
cli
.
IntFlag
{
Name
:
"protocolversion"
,
Usage
:
"ETH protocol version"
,
Value
:
eth
.
ProtocolVersion
,
}
NetworkIdFlag
=
cli
.
IntFlag
{
Name
:
"networkid"
,
Usage
:
"Network Id"
,
Value
:
eth
.
NetworkId
,
}
// miner settings
MinerThreadsFlag
=
cli
.
IntFlag
{
Name
:
"minerthreads"
,
Usage
:
"Number of miner threads"
,
...
...
@@ -98,11 +96,18 @@ var (
Name
:
"mine"
,
Usage
:
"Enable mining"
,
}
// key settings
UnencryptedKeysFlag
=
cli
.
BoolFlag
{
Name
:
"unencrypted-keys"
,
Usage
:
"disable private key disk encryption (for testing)"
,
}
UnlockedAccountFlag
=
cli
.
StringFlag
{
Name
:
"unlock"
,
Usage
:
"Unlock a given account untill this programs exits (address:password)"
,
}
// logging and debug settings
LogFileFlag
=
cli
.
StringFlag
{
Name
:
"logfile"
,
Usage
:
"Send log output to a file"
,
...
...
@@ -117,6 +122,10 @@ var (
Usage
:
`"std" or "raw"`
,
Value
:
"std"
,
}
VMDebugFlag
=
cli
.
BoolFlag
{
Name
:
"vmdebug"
,
Usage
:
"Virtual Machine debug output"
,
}
// RPC settings
RPCEnabledFlag
=
cli
.
BoolFlag
{
...
...
@@ -198,21 +207,23 @@ func GetNodeKey(ctx *cli.Context) (key *ecdsa.PrivateKey) {
func
MakeEthConfig
(
clientID
,
version
string
,
ctx
*
cli
.
Context
)
*
eth
.
Config
{
return
&
eth
.
Config
{
Name
:
common
.
MakeName
(
clientID
,
version
),
DataDir
:
ctx
.
GlobalString
(
DataDirFlag
.
Name
),
LogFile
:
ctx
.
GlobalString
(
LogFileFlag
.
Name
),
LogLevel
:
ctx
.
GlobalInt
(
LogLevelFlag
.
Name
),
LogFormat
:
ctx
.
GlobalString
(
LogFormatFlag
.
Name
),
MinerThreads
:
ctx
.
GlobalInt
(
MinerThreadsFlag
.
Name
),
AccountManager
:
GetAccountManager
(
ctx
),
VmDebug
:
ctx
.
GlobalBool
(
VMDebugFlag
.
Name
),
MaxPeers
:
ctx
.
GlobalInt
(
MaxPeersFlag
.
Name
),
Port
:
ctx
.
GlobalString
(
ListenPortFlag
.
Name
),
NAT
:
GetNAT
(
ctx
),
NodeKey
:
GetNodeKey
(
ctx
),
Shh
:
true
,
Dial
:
true
,
BootNodes
:
ctx
.
GlobalString
(
BootnodesFlag
.
Name
),
Name
:
common
.
MakeName
(
clientID
,
version
),
DataDir
:
ctx
.
GlobalString
(
DataDirFlag
.
Name
),
ProtocolVersion
:
ctx
.
GlobalInt
(
ProtocolVersionFlag
.
Name
),
NetworkId
:
ctx
.
GlobalInt
(
NetworkIdFlag
.
Name
),
LogFile
:
ctx
.
GlobalString
(
LogFileFlag
.
Name
),
LogLevel
:
ctx
.
GlobalInt
(
LogLevelFlag
.
Name
),
LogFormat
:
ctx
.
GlobalString
(
LogFormatFlag
.
Name
),
MinerThreads
:
ctx
.
GlobalInt
(
MinerThreadsFlag
.
Name
),
AccountManager
:
GetAccountManager
(
ctx
),
VmDebug
:
ctx
.
GlobalBool
(
VMDebugFlag
.
Name
),
MaxPeers
:
ctx
.
GlobalInt
(
MaxPeersFlag
.
Name
),
Port
:
ctx
.
GlobalString
(
ListenPortFlag
.
Name
),
NAT
:
GetNAT
(
ctx
),
NodeKey
:
GetNodeKey
(
ctx
),
Shh
:
true
,
Dial
:
true
,
BootNodes
:
ctx
.
GlobalString
(
BootnodesFlag
.
Name
),
}
}
...
...
eth/backend.go
浏览文件 @
af9da83c
...
...
@@ -10,11 +10,11 @@ import (
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/blockpool"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/miner"
...
...
@@ -38,7 +38,10 @@ var (
)
type
Config
struct
{
Name
string
Name
string
ProtocolVersion
int
NetworkId
int
DataDir
string
LogFile
string
LogLevel
int
...
...
@@ -135,14 +138,16 @@ type Ethereum struct {
logger
logger
.
LogSystem
Mining
bool
DataDir
string
version
string
Mining
bool
DataDir
string
version
string
ProtocolVersion
int
NetworkId
int
}
func
New
(
config
*
Config
)
(
*
Ethereum
,
error
)
{
// Boostrap database
servlog
ger
:=
logger
.
New
(
config
.
DataDir
,
config
.
LogFile
,
config
.
LogLevel
,
config
.
LogFormat
)
servlog
system
:=
logger
.
New
(
config
.
DataDir
,
config
.
LogFile
,
config
.
LogLevel
,
config
.
LogFormat
)
newdb
:=
config
.
NewDB
if
newdb
==
nil
{
...
...
@@ -159,13 +164,14 @@ func New(config *Config) (*Ethereum, error) {
extraDb
,
err
:=
ethdb
.
NewLDBDatabase
(
path
.
Join
(
config
.
DataDir
,
"extra"
))
// Perform database sanity checks
d
,
_
:=
block
Db
.
Get
([]
byte
(
"ProtocolVersion"
))
protov
:=
common
.
NewValue
(
d
)
.
Uint
(
)
if
protov
!=
ProtocolVersion
&&
protov
!=
0
{
d
,
_
:=
extra
Db
.
Get
([]
byte
(
"ProtocolVersion"
))
protov
:=
int
(
common
.
NewValue
(
d
)
.
Uint
()
)
if
protov
!=
config
.
ProtocolVersion
&&
protov
!=
0
{
path
:=
path
.
Join
(
config
.
DataDir
,
"blockchain"
)
return
nil
,
fmt
.
Errorf
(
"Database version mismatch. Protocol(%d / %d). `rm -rf %s`"
,
protov
,
ProtocolVersion
,
path
)
return
nil
,
fmt
.
Errorf
(
"Database version mismatch. Protocol(%d / %d). `rm -rf %s`"
,
protov
,
config
.
ProtocolVersion
,
path
)
}
saveProtocolVersion
(
extraDb
)
saveProtocolVersion
(
extraDb
,
config
.
ProtocolVersion
)
servlogger
.
Infof
(
"Protocol Version: %v, Network Id: %v"
,
config
.
ProtocolVersion
,
config
.
NetworkId
)
eth
:=
&
Ethereum
{
shutdownChan
:
make
(
chan
bool
),
...
...
@@ -173,7 +179,7 @@ func New(config *Config) (*Ethereum, error) {
stateDb
:
stateDb
,
extraDb
:
extraDb
,
eventMux
:
&
event
.
TypeMux
{},
logger
:
servlog
ger
,
logger
:
servlog
system
,
accountManager
:
config
.
AccountManager
,
DataDir
:
config
.
DataDir
,
version
:
config
.
Name
,
// TODO should separate from Name
...
...
@@ -195,7 +201,8 @@ func New(config *Config) (*Ethereum, error) {
if
err
!=
nil
{
return
nil
,
err
}
ethProto
:=
EthProtocol
(
eth
.
txPool
,
eth
.
chainManager
,
eth
.
blockPool
)
ethProto
:=
EthProtocol
(
config
.
ProtocolVersion
,
config
.
NetworkId
,
eth
.
txPool
,
eth
.
chainManager
,
eth
.
blockPool
)
protocols
:=
[]
p2p
.
Protocol
{
ethProto
}
if
config
.
Shh
{
protocols
=
append
(
protocols
,
eth
.
whisper
.
Protocol
())
...
...
@@ -304,12 +311,11 @@ func (s *Ethereum) TxPool() *core.TxPool { return s.txPool }
func
(
s
*
Ethereum
)
BlockPool
()
*
blockpool
.
BlockPool
{
return
s
.
blockPool
}
func
(
s
*
Ethereum
)
Whisper
()
*
whisper
.
Whisper
{
return
s
.
whisper
}
func
(
s
*
Ethereum
)
EventMux
()
*
event
.
TypeMux
{
return
s
.
eventMux
}
func
(
s
*
Ethereum
)
BlockDb
()
common
.
Database
{
return
s
.
blockDb
}
func
(
s
*
Ethereum
)
StateDb
()
common
.
Database
{
return
s
.
stateDb
}
func
(
s
*
Ethereum
)
ExtraDb
()
common
.
Database
{
return
s
.
extraDb
}
func
(
s
*
Ethereum
)
BlockDb
()
common
.
Database
{
return
s
.
blockDb
}
func
(
s
*
Ethereum
)
StateDb
()
common
.
Database
{
return
s
.
stateDb
}
func
(
s
*
Ethereum
)
ExtraDb
()
common
.
Database
{
return
s
.
extraDb
}
func
(
s
*
Ethereum
)
IsListening
()
bool
{
return
true
}
// Always listening
func
(
s
*
Ethereum
)
PeerCount
()
int
{
return
s
.
net
.
PeerCount
()
}
func
(
s
*
Ethereum
)
PeerInfo
()
int
{
return
s
.
net
.
PeerCount
()
}
func
(
s
*
Ethereum
)
Peers
()
[]
*
p2p
.
Peer
{
return
s
.
net
.
Peers
()
}
func
(
s
*
Ethereum
)
MaxPeers
()
int
{
return
s
.
net
.
MaxPeers
}
func
(
s
*
Ethereum
)
Version
()
string
{
return
s
.
version
}
...
...
@@ -413,11 +419,11 @@ func (self *Ethereum) blockBroadcastLoop() {
}
}
func
saveProtocolVersion
(
db
common
.
Database
)
{
func
saveProtocolVersion
(
db
common
.
Database
,
protov
int
)
{
d
,
_
:=
db
.
Get
([]
byte
(
"ProtocolVersion"
))
protocolVersion
:=
common
.
NewValue
(
d
)
.
Uint
()
if
protocolVersion
==
0
{
db
.
Put
([]
byte
(
"ProtocolVersion"
),
common
.
NewValue
(
ProtocolVersion
)
.
Bytes
())
db
.
Put
([]
byte
(
"ProtocolVersion"
),
common
.
NewValue
(
protov
)
.
Bytes
())
}
}
eth/peer_util.go
已删除
100644 → 0
浏览文件 @
e30c3233
package
eth
import
(
"encoding/json"
"github.com/ethereum/go-ethereum/common"
)
func
WritePeers
(
path
string
,
addresses
[]
string
)
{
if
len
(
addresses
)
>
0
{
data
,
_
:=
json
.
MarshalIndent
(
addresses
,
""
,
" "
)
common
.
WriteFile
(
path
,
data
)
}
}
func
ReadPeers
(
path
string
)
(
ips
[]
string
,
err
error
)
{
var
data
string
data
,
err
=
common
.
ReadAllFile
(
path
)
if
err
!=
nil
{
json
.
Unmarshal
([]
byte
(
data
),
&
ips
)
}
return
}
eth/protocol.go
浏览文件 @
af9da83c
...
...
@@ -5,9 +5,9 @@ import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/errs"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
...
...
@@ -59,13 +59,15 @@ var errorToString = map[int]string{
// ethProtocol represents the ethereum wire protocol
// instance is running on each peer
type
ethProtocol
struct
{
txPool
txPool
chainManager
chainManager
blockPool
blockPool
peer
*
p2p
.
Peer
id
string
rw
p2p
.
MsgReadWriter
errors
*
errs
.
Errors
txPool
txPool
chainManager
chainManager
blockPool
blockPool
peer
*
p2p
.
Peer
id
string
rw
p2p
.
MsgReadWriter
errors
*
errs
.
Errors
protocolVersion
int
networkId
int
}
// backend is the interface the ethereum protocol backend should implement
...
...
@@ -102,27 +104,29 @@ type getBlockHashesMsgData struct {
// main entrypoint, wrappers starting a server running the eth protocol
// use this constructor to attach the protocol ("class") to server caps
// the Dev p2p layer then runs the protocol instance on each peer
func
EthProtocol
(
txPool
txPool
,
chainManager
chainManager
,
blockPool
blockPool
)
p2p
.
Protocol
{
func
EthProtocol
(
protocolVersion
,
networkId
int
,
txPool
txPool
,
chainManager
chainManager
,
blockPool
blockPool
)
p2p
.
Protocol
{
return
p2p
.
Protocol
{
Name
:
"eth"
,
Version
:
ProtocolVersion
,
Version
:
uint
(
protocolVersion
)
,
Length
:
ProtocolLength
,
Run
:
func
(
peer
*
p2p
.
Peer
,
rw
p2p
.
MsgReadWriter
)
error
{
return
runEthProtocol
(
txPool
,
chainManager
,
blockPool
,
peer
,
rw
)
return
runEthProtocol
(
protocolVersion
,
networkId
,
txPool
,
chainManager
,
blockPool
,
peer
,
rw
)
},
}
}
// the main loop that handles incoming messages
// note RemovePeer in the post-disconnect hook
func
runEthProtocol
(
txPool
txPool
,
chainManager
chainManager
,
blockPool
blockPool
,
peer
*
p2p
.
Peer
,
rw
p2p
.
MsgReadWriter
)
(
err
error
)
{
func
runEthProtocol
(
protocolVersion
,
networkId
int
,
txPool
txPool
,
chainManager
chainManager
,
blockPool
blockPool
,
peer
*
p2p
.
Peer
,
rw
p2p
.
MsgReadWriter
)
(
err
error
)
{
id
:=
peer
.
ID
()
self
:=
&
ethProtocol
{
txPool
:
txPool
,
chainManager
:
chainManager
,
blockPool
:
blockPool
,
rw
:
rw
,
peer
:
peer
,
txPool
:
txPool
,
chainManager
:
chainManager
,
blockPool
:
blockPool
,
rw
:
rw
,
peer
:
peer
,
protocolVersion
:
protocolVersion
,
networkId
:
networkId
,
errors
:
&
errs
.
Errors
{
Package
:
"ETH"
,
Errors
:
errorToString
,
...
...
@@ -290,8 +294,8 @@ func (self *ethProtocol) statusMsg() p2p.Msg {
td
,
currentBlock
,
genesisBlock
:=
self
.
chainManager
.
Status
()
return
p2p
.
NewMsg
(
StatusMsg
,
uint32
(
P
rotocolVersion
),
uint32
(
N
etworkId
),
uint32
(
self
.
p
rotocolVersion
),
uint32
(
self
.
n
etworkId
),
td
,
currentBlock
,
genesisBlock
,
...
...
@@ -329,12 +333,12 @@ func (self *ethProtocol) handleStatus() error {
return
self
.
protoError
(
ErrGenesisBlockMismatch
,
"%x (!= %x)"
,
status
.
GenesisBlock
,
genesisBlock
)
}
if
status
.
NetworkId
!=
N
etworkId
{
return
self
.
protoError
(
ErrNetworkIdMismatch
,
"%d (!= %d)"
,
status
.
NetworkId
,
N
etworkId
)
if
int
(
status
.
NetworkId
)
!=
self
.
n
etworkId
{
return
self
.
protoError
(
ErrNetworkIdMismatch
,
"%d (!= %d)"
,
status
.
NetworkId
,
self
.
n
etworkId
)
}
if
ProtocolVersion
!=
status
.
P
rotocolVersion
{
return
self
.
protoError
(
ErrProtocolVersionMismatch
,
"%d (!= %d)"
,
status
.
ProtocolVersion
,
P
rotocolVersion
)
if
int
(
status
.
ProtocolVersion
)
!=
self
.
p
rotocolVersion
{
return
self
.
protoError
(
ErrProtocolVersionMismatch
,
"%d (!= %d)"
,
status
.
ProtocolVersion
,
self
.
p
rotocolVersion
)
}
self
.
peer
.
Infof
(
"Peer is [eth] capable (%d/%d). TD=%v H=%x
\n
"
,
status
.
ProtocolVersion
,
status
.
NetworkId
,
status
.
TD
,
status
.
CurrentBlock
[
:
4
])
...
...
eth/protocol_test.go
浏览文件 @
af9da83c
...
...
@@ -9,10 +9,10 @@ import (
"testing"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/errs"
"github.com/ethereum/go-ethereum/common"
ethlogger
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
...
...
@@ -216,7 +216,7 @@ func (self *ethProtocolTester) checkMsg(i int, code uint64, val interface{}) (ms
}
func
(
self
*
ethProtocolTester
)
run
()
{
err
:=
runEthProtocol
(
self
.
txPool
,
self
.
chainManager
,
self
.
blockPool
,
testPeer
(),
self
.
rw
)
err
:=
runEthProtocol
(
ProtocolVersion
,
NetworkId
,
self
.
txPool
,
self
.
chainManager
,
self
.
blockPool
,
testPeer
(),
self
.
rw
)
self
.
quit
<-
err
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录