aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-09-06 21:46:54 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-09-09 14:53:05 +0800
commitf04b3a6f293ef15151dc040183ab74ef5ce54d2a (patch)
tree4e74df1f20d9a9f83c10370ce6eb428f6fbaf0e2 /cmd/utils
parente2d7c1a52303ebdd8c2956badad5e600bf93ff33 (diff)
downloaddexon-f04b3a6f293ef15151dc040183ab74ef5ce54d2a.tar
dexon-f04b3a6f293ef15151dc040183ab74ef5ce54d2a.tar.gz
dexon-f04b3a6f293ef15151dc040183ab74ef5ce54d2a.tar.bz2
dexon-f04b3a6f293ef15151dc040183ab74ef5ce54d2a.tar.lz
dexon-f04b3a6f293ef15151dc040183ab74ef5ce54d2a.tar.xz
dexon-f04b3a6f293ef15151dc040183ab74ef5ce54d2a.tar.zst
dexon-f04b3a6f293ef15151dc040183ab74ef5ce54d2a.zip
cmd/geth, cmd/utils, eth: added dev mode flag
Dev mode enabled some debugging flags such as: * VM debugging mode * Simpler proof of work * Whisper enabled by default * Datadir to a tmp datadir * Maxpeers set to 0 * Gas price of 0 * Random listen port
Diffstat (limited to 'cmd/utils')
-rw-r--r--cmd/utils/flags.go33
1 files changed, 32 insertions, 1 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 80805ca22..95fb649e6 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -121,6 +121,10 @@ var (
Name: "genesis",
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{
Name: "identity",
Usage: "Custom node name",
@@ -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")
}
- return &eth.Config{
+ cfg := &eth.Config{
Name: common.MakeName(clientID, version),
DataDir: ctx.GlobalString(DataDirFlag.Name),
GenesisNonce: ctx.GlobalInt(GenesisNonceFlag.Name),
@@ -447,6 +451,33 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
SolcPath: ctx.GlobalString(SolcPathFlag.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.