Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
4e075e40
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,发现更多精彩内容 >>
提交
4e075e40
编写于
9月 10, 2015
作者:
F
Felix Lange
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1773 from obscuren/dev-mode
cmd/geth, cmd/utils, eth: added dev mode flag
上级
62bbf8a0
f04b3a6f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
7 deletion
+42
-7
cmd/geth/main.go
cmd/geth/main.go
+1
-0
cmd/utils/flags.go
cmd/utils/flags.go
+32
-1
eth/backend.go
eth/backend.go
+9
-6
未找到文件。
cmd/geth/main.go
浏览文件 @
4e075e40
...
@@ -308,6 +308,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
...
@@ -308,6 +308,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils
.
IPCPathFlag
,
utils
.
IPCPathFlag
,
utils
.
ExecFlag
,
utils
.
ExecFlag
,
utils
.
WhisperEnabledFlag
,
utils
.
WhisperEnabledFlag
,
utils
.
DevModeFlag
,
utils
.
VMDebugFlag
,
utils
.
VMDebugFlag
,
utils
.
VMForceJitFlag
,
utils
.
VMForceJitFlag
,
utils
.
VMJitCacheFlag
,
utils
.
VMJitCacheFlag
,
...
...
cmd/utils/flags.go
浏览文件 @
4e075e40
...
@@ -121,6 +121,10 @@ var (
...
@@ -121,6 +121,10 @@ var (
Name
:
"genesis"
,
Name
:
"genesis"
,
Usage
:
"Inserts/Overwrites the genesis block (json format)"
,
Usage
:
"Inserts/Overwrites the genesis block (json format)"
,
}
}
DevModeFlag
=
cli
.
BoolFlag
{
Name
:
"dev"
,
Usage
:
"Developer mode. This mode creates a private network and sets several debugging flags"
,
}
IdentityFlag
=
cli
.
StringFlag
{
IdentityFlag
=
cli
.
StringFlag
{
Name
:
"identity"
,
Name
:
"identity"
,
Usage
:
"Custom node name"
,
Usage
:
"Custom node name"
,
...
@@ -410,7 +414,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
...
@@ -410,7 +414,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"WARNING: No etherbase set and no accounts found as default"
)
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"WARNING: No etherbase set and no accounts found as default"
)
}
}
return
&
eth
.
Config
{
cfg
:=
&
eth
.
Config
{
Name
:
common
.
MakeName
(
clientID
,
version
),
Name
:
common
.
MakeName
(
clientID
,
version
),
DataDir
:
ctx
.
GlobalString
(
DataDirFlag
.
Name
),
DataDir
:
ctx
.
GlobalString
(
DataDirFlag
.
Name
),
GenesisNonce
:
ctx
.
GlobalInt
(
GenesisNonceFlag
.
Name
),
GenesisNonce
:
ctx
.
GlobalInt
(
GenesisNonceFlag
.
Name
),
...
@@ -447,6 +451,33 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
...
@@ -447,6 +451,33 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
SolcPath
:
ctx
.
GlobalString
(
SolcPathFlag
.
Name
),
SolcPath
:
ctx
.
GlobalString
(
SolcPathFlag
.
Name
),
AutoDAG
:
ctx
.
GlobalBool
(
AutoDAGFlag
.
Name
)
||
ctx
.
GlobalBool
(
MiningEnabledFlag
.
Name
),
AutoDAG
:
ctx
.
GlobalBool
(
AutoDAGFlag
.
Name
)
||
ctx
.
GlobalBool
(
MiningEnabledFlag
.
Name
),
}
}
if
ctx
.
GlobalBool
(
DevModeFlag
.
Name
)
{
if
!
ctx
.
GlobalIsSet
(
VMDebugFlag
.
Name
)
{
cfg
.
VmDebug
=
true
}
if
!
ctx
.
GlobalIsSet
(
MaxPeersFlag
.
Name
)
{
cfg
.
MaxPeers
=
0
}
if
!
ctx
.
GlobalIsSet
(
GasPriceFlag
.
Name
)
{
cfg
.
GasPrice
=
new
(
big
.
Int
)
}
if
!
ctx
.
GlobalIsSet
(
ListenPortFlag
.
Name
)
{
cfg
.
Port
=
"0"
// auto port
}
if
!
ctx
.
GlobalIsSet
(
WhisperEnabledFlag
.
Name
)
{
cfg
.
Shh
=
true
}
if
!
ctx
.
GlobalIsSet
(
DataDirFlag
.
Name
)
{
cfg
.
DataDir
=
os
.
TempDir
()
+
"/ethereum_dev_mode"
}
cfg
.
PowTest
=
true
cfg
.
DevMode
=
true
glog
.
V
(
logger
.
Info
)
.
Infoln
(
"dev mode enabled"
)
}
return
cfg
}
}
// SetupLogger configures glog from the logging-related command line flags.
// SetupLogger configures glog from the logging-related command line flags.
...
...
eth/backend.go
浏览文件 @
4e075e40
...
@@ -73,6 +73,8 @@ var (
...
@@ -73,6 +73,8 @@ var (
)
)
type
Config
struct
{
type
Config
struct
{
DevMode
bool
Name
string
Name
string
NetworkId
int
NetworkId
int
GenesisNonce
int
GenesisNonce
int
...
@@ -303,16 +305,17 @@ func New(config *Config) (*Ethereum, error) {
...
@@ -303,16 +305,17 @@ func New(config *Config) (*Ethereum, error) {
glog
.
V
(
logger
.
Info
)
.
Infof
(
"Successfully wrote genesis block. New genesis hash = %x
\n
"
,
block
.
Hash
())
glog
.
V
(
logger
.
Info
)
.
Infof
(
"Successfully wrote genesis block. New genesis hash = %x
\n
"
,
block
.
Hash
())
}
}
if
config
.
Olympic
{
// different modes
switch
{
case
config
.
Olympic
:
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"Starting Olympic network"
)
fallthrough
case
config
.
DevMode
:
_
,
err
:=
core
.
WriteTestNetGenesisBlock
(
chainDb
,
42
)
_
,
err
:=
core
.
WriteTestNetGenesisBlock
(
chainDb
,
42
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"Starting Olympic network"
)
case
config
.
GenesisBlock
!=
nil
:
// This is for testing only.
}
// This is for testing only.
if
config
.
GenesisBlock
!=
nil
{
core
.
WriteBlock
(
chainDb
,
config
.
GenesisBlock
)
core
.
WriteBlock
(
chainDb
,
config
.
GenesisBlock
)
core
.
WriteHead
(
chainDb
,
config
.
GenesisBlock
)
core
.
WriteHead
(
chainDb
,
config
.
GenesisBlock
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录