@@ -121,6 +121,10 @@ var (
121
121
Name : "genesis" ,
122
122
Usage : "Inserts/Overwrites the genesis block (json format)" ,
123
123
}
124
+ DevModeFlag = cli.BoolFlag {
125
+ Name : "dev" ,
126
+ Usage : "Developer mode. This mode creates a private network and sets several debugging flags" ,
127
+ }
124
128
IdentityFlag = cli.StringFlag {
125
129
Name : "identity" ,
126
130
Usage : "Custom node name" ,
@@ -410,7 +414,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
410
414
glog .V (logger .Error ).Infoln ("WARNING: No etherbase set and no accounts found as default" )
411
415
}
412
416
413
- return & eth.Config {
417
+ cfg := & eth.Config {
414
418
Name : common .MakeName (clientID , version ),
415
419
DataDir : ctx .GlobalString (DataDirFlag .Name ),
416
420
GenesisNonce : ctx .GlobalInt (GenesisNonceFlag .Name ),
@@ -447,6 +451,33 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
447
451
SolcPath : ctx .GlobalString (SolcPathFlag .Name ),
448
452
AutoDAG : ctx .GlobalBool (AutoDAGFlag .Name ) || ctx .GlobalBool (MiningEnabledFlag .Name ),
449
453
}
454
+
455
+ if ctx .GlobalBool (DevModeFlag .Name ) {
456
+ if ! ctx .GlobalIsSet (VMDebugFlag .Name ) {
457
+ cfg .VmDebug = true
458
+ }
459
+ if ! ctx .GlobalIsSet (MaxPeersFlag .Name ) {
460
+ cfg .MaxPeers = 0
461
+ }
462
+ if ! ctx .GlobalIsSet (GasPriceFlag .Name ) {
463
+ cfg .GasPrice = new (big.Int )
464
+ }
465
+ if ! ctx .GlobalIsSet (ListenPortFlag .Name ) {
466
+ cfg .Port = "0" // auto port
467
+ }
468
+ if ! ctx .GlobalIsSet (WhisperEnabledFlag .Name ) {
469
+ cfg .Shh = true
470
+ }
471
+ if ! ctx .GlobalIsSet (DataDirFlag .Name ) {
472
+ cfg .DataDir = os .TempDir () + "/ethereum_dev_mode"
473
+ }
474
+ cfg .PowTest = true
475
+ cfg .DevMode = true
476
+
477
+ glog .V (logger .Info ).Infoln ("dev mode enabled" )
478
+ }
479
+
480
+ return cfg
450
481
}
451
482
452
483
// SetupLogger configures glog from the logging-related command line flags.
0 commit comments