@@ -49,6 +49,7 @@ import (
4949 "github.com/ethereum/go-ethereum/log"
5050 "github.com/ethereum/go-ethereum/metrics"
5151 "github.com/ethereum/go-ethereum/metrics/influxdb"
52+ "github.com/ethereum/go-ethereum/miner"
5253 "github.com/ethereum/go-ethereum/node"
5354 "github.com/ethereum/go-ethereum/p2p"
5455 "github.com/ethereum/go-ethereum/p2p/discv5"
@@ -375,27 +376,27 @@ var (
375376 MinerGasTargetFlag = cli.Uint64Flag {
376377 Name : "miner.gastarget" ,
377378 Usage : "Target gas floor for mined blocks" ,
378- Value : eth .DefaultConfig .MinerGasFloor ,
379+ Value : eth .DefaultConfig .Miner . GasFloor ,
379380 }
380381 MinerLegacyGasTargetFlag = cli.Uint64Flag {
381382 Name : "targetgaslimit" ,
382383 Usage : "Target gas floor for mined blocks (deprecated, use --miner.gastarget)" ,
383- Value : eth .DefaultConfig .MinerGasFloor ,
384+ Value : eth .DefaultConfig .Miner . GasFloor ,
384385 }
385386 MinerGasLimitFlag = cli.Uint64Flag {
386387 Name : "miner.gaslimit" ,
387388 Usage : "Target gas ceiling for mined blocks" ,
388- Value : eth .DefaultConfig .MinerGasCeil ,
389+ Value : eth .DefaultConfig .Miner . GasCeil ,
389390 }
390391 MinerGasPriceFlag = BigFlag {
391392 Name : "miner.gasprice" ,
392393 Usage : "Minimum gas price for mining a transaction" ,
393- Value : eth .DefaultConfig .MinerGasPrice ,
394+ Value : eth .DefaultConfig .Miner . GasPrice ,
394395 }
395396 MinerLegacyGasPriceFlag = BigFlag {
396397 Name : "gasprice" ,
397398 Usage : "Minimum gas price for mining a transaction (deprecated, use --miner.gasprice)" ,
398- Value : eth .DefaultConfig .MinerGasPrice ,
399+ Value : eth .DefaultConfig .Miner . GasPrice ,
399400 }
400401 MinerEtherbaseFlag = cli.StringFlag {
401402 Name : "miner.etherbase" ,
@@ -418,7 +419,7 @@ var (
418419 MinerRecommitIntervalFlag = cli.DurationFlag {
419420 Name : "miner.recommit" ,
420421 Usage : "Time interval to recreate the block being mined" ,
421- Value : eth .DefaultConfig .MinerRecommit ,
422+ Value : eth .DefaultConfig .Miner . Recommit ,
422423 }
423424 MinerNoVerfiyFlag = cli.BoolFlag {
424425 Name : "miner.noverify" ,
@@ -1023,7 +1024,7 @@ func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *eth.Config) {
10231024 if err != nil {
10241025 Fatalf ("Invalid miner etherbase: %v" , err )
10251026 }
1026- cfg .Etherbase = account .Address
1027+ cfg .Miner . Etherbase = account .Address
10271028 } else {
10281029 Fatalf ("No etherbase configured" )
10291030 }
@@ -1231,6 +1232,39 @@ func setEthash(ctx *cli.Context, cfg *eth.Config) {
12311232 }
12321233}
12331234
1235+ func setMiner (ctx * cli.Context , cfg * miner.Config ) {
1236+ if ctx .GlobalIsSet (MinerNotifyFlag .Name ) {
1237+ cfg .Notify = strings .Split (ctx .GlobalString (MinerNotifyFlag .Name ), "," )
1238+ }
1239+ if ctx .GlobalIsSet (MinerLegacyExtraDataFlag .Name ) {
1240+ cfg .ExtraData = []byte (ctx .GlobalString (MinerLegacyExtraDataFlag .Name ))
1241+ }
1242+ if ctx .GlobalIsSet (MinerExtraDataFlag .Name ) {
1243+ cfg .ExtraData = []byte (ctx .GlobalString (MinerExtraDataFlag .Name ))
1244+ }
1245+ if ctx .GlobalIsSet (MinerLegacyGasTargetFlag .Name ) {
1246+ cfg .GasFloor = ctx .GlobalUint64 (MinerLegacyGasTargetFlag .Name )
1247+ }
1248+ if ctx .GlobalIsSet (MinerGasTargetFlag .Name ) {
1249+ cfg .GasFloor = ctx .GlobalUint64 (MinerGasTargetFlag .Name )
1250+ }
1251+ if ctx .GlobalIsSet (MinerGasLimitFlag .Name ) {
1252+ cfg .GasCeil = ctx .GlobalUint64 (MinerGasLimitFlag .Name )
1253+ }
1254+ if ctx .GlobalIsSet (MinerLegacyGasPriceFlag .Name ) {
1255+ cfg .GasPrice = GlobalBig (ctx , MinerLegacyGasPriceFlag .Name )
1256+ }
1257+ if ctx .GlobalIsSet (MinerGasPriceFlag .Name ) {
1258+ cfg .GasPrice = GlobalBig (ctx , MinerGasPriceFlag .Name )
1259+ }
1260+ if ctx .GlobalIsSet (MinerRecommitIntervalFlag .Name ) {
1261+ cfg .Recommit = ctx .Duration (MinerRecommitIntervalFlag .Name )
1262+ }
1263+ if ctx .GlobalIsSet (MinerNoVerfiyFlag .Name ) {
1264+ cfg .Noverify = ctx .Bool (MinerNoVerfiyFlag .Name )
1265+ }
1266+ }
1267+
12341268func setWhitelist (ctx * cli.Context , cfg * eth.Config ) {
12351269 whitelist := ctx .GlobalString (WhitelistFlag .Name )
12361270 if whitelist == "" {
@@ -1323,6 +1357,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
13231357 setGPO (ctx , & cfg .GPO )
13241358 setTxPool (ctx , & cfg .TxPool )
13251359 setEthash (ctx , cfg )
1360+ setMiner (ctx , & cfg .Miner )
13261361 setWhitelist (ctx , cfg )
13271362
13281363 if ctx .GlobalIsSet (SyncModeFlag .Name ) {
@@ -1359,39 +1394,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
13591394 if ctx .GlobalIsSet (CacheFlag .Name ) || ctx .GlobalIsSet (CacheGCFlag .Name ) {
13601395 cfg .TrieDirtyCache = ctx .GlobalInt (CacheFlag .Name ) * ctx .GlobalInt (CacheGCFlag .Name ) / 100
13611396 }
1362- if ctx .GlobalIsSet (MinerNotifyFlag .Name ) {
1363- cfg .MinerNotify = strings .Split (ctx .GlobalString (MinerNotifyFlag .Name ), "," )
1364- }
13651397 if ctx .GlobalIsSet (DocRootFlag .Name ) {
13661398 cfg .DocRoot = ctx .GlobalString (DocRootFlag .Name )
13671399 }
1368- if ctx .GlobalIsSet (MinerLegacyExtraDataFlag .Name ) {
1369- cfg .MinerExtraData = []byte (ctx .GlobalString (MinerLegacyExtraDataFlag .Name ))
1370- }
1371- if ctx .GlobalIsSet (MinerExtraDataFlag .Name ) {
1372- cfg .MinerExtraData = []byte (ctx .GlobalString (MinerExtraDataFlag .Name ))
1373- }
1374- if ctx .GlobalIsSet (MinerLegacyGasTargetFlag .Name ) {
1375- cfg .MinerGasFloor = ctx .GlobalUint64 (MinerLegacyGasTargetFlag .Name )
1376- }
1377- if ctx .GlobalIsSet (MinerGasTargetFlag .Name ) {
1378- cfg .MinerGasFloor = ctx .GlobalUint64 (MinerGasTargetFlag .Name )
1379- }
1380- if ctx .GlobalIsSet (MinerGasLimitFlag .Name ) {
1381- cfg .MinerGasCeil = ctx .GlobalUint64 (MinerGasLimitFlag .Name )
1382- }
1383- if ctx .GlobalIsSet (MinerLegacyGasPriceFlag .Name ) {
1384- cfg .MinerGasPrice = GlobalBig (ctx , MinerLegacyGasPriceFlag .Name )
1385- }
1386- if ctx .GlobalIsSet (MinerGasPriceFlag .Name ) {
1387- cfg .MinerGasPrice = GlobalBig (ctx , MinerGasPriceFlag .Name )
1388- }
1389- if ctx .GlobalIsSet (MinerRecommitIntervalFlag .Name ) {
1390- cfg .MinerRecommit = ctx .Duration (MinerRecommitIntervalFlag .Name )
1391- }
1392- if ctx .GlobalIsSet (MinerNoVerfiyFlag .Name ) {
1393- cfg .MinerNoverify = ctx .Bool (MinerNoVerfiyFlag .Name )
1394- }
13951400 if ctx .GlobalIsSet (VMEnableDebugFlag .Name ) {
13961401 // TODO(fjl): force-enable this in --dev mode
13971402 cfg .EnablePreimageRecording = ctx .GlobalBool (VMEnableDebugFlag .Name )
@@ -1449,7 +1454,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
14491454
14501455 cfg .Genesis = core .DeveloperGenesisBlock (uint64 (ctx .GlobalInt (DeveloperPeriodFlag .Name )), developer .Address )
14511456 if ! ctx .GlobalIsSet (MinerGasPriceFlag .Name ) && ! ctx .GlobalIsSet (MinerLegacyGasPriceFlag .Name ) {
1452- cfg .MinerGasPrice = big .NewInt (1 )
1457+ cfg .Miner . GasPrice = big .NewInt (1 )
14531458 }
14541459 }
14551460}
0 commit comments