cmd: polish miner flags, deprecate olds, add upgrade path
This commit is contained in:
		| @@ -82,8 +82,6 @@ var ( | ||||
| 		utils.TxPoolAccountQueueFlag, | ||||
| 		utils.TxPoolGlobalQueueFlag, | ||||
| 		utils.TxPoolLifetimeFlag, | ||||
| 		utils.FastSyncFlag, | ||||
| 		utils.LightModeFlag, | ||||
| 		utils.SyncModeFlag, | ||||
| 		utils.GCModeFlag, | ||||
| 		utils.LightServFlag, | ||||
| @@ -96,12 +94,18 @@ var ( | ||||
| 		utils.ListenPortFlag, | ||||
| 		utils.MaxPeersFlag, | ||||
| 		utils.MaxPendingPeersFlag, | ||||
| 		utils.EtherbaseFlag, | ||||
| 		utils.GasPriceFlag, | ||||
| 		utils.MiningEnabledFlag, | ||||
| 		utils.MinerThreadsFlag, | ||||
| 		utils.MinerLegacyThreadsFlag, | ||||
| 		utils.MinerNotifyFlag, | ||||
| 		utils.TargetGasLimitFlag, | ||||
| 		utils.MinerGasTargetFlag, | ||||
| 		utils.MinerLegacyGasTargetFlag, | ||||
| 		utils.MinerGasPriceFlag, | ||||
| 		utils.MinerLegacyGasPriceFlag, | ||||
| 		utils.MinerEtherbaseFlag, | ||||
| 		utils.MinerLegacyEtherbaseFlag, | ||||
| 		utils.MinerExtraDataFlag, | ||||
| 		utils.MinerLegacyExtraDataFlag, | ||||
| 		utils.NATFlag, | ||||
| 		utils.NoDiscoverFlag, | ||||
| 		utils.DiscoveryV5Flag, | ||||
| @@ -122,7 +126,6 @@ var ( | ||||
| 		utils.NoCompactionFlag, | ||||
| 		utils.GpoBlocksFlag, | ||||
| 		utils.GpoPercentileFlag, | ||||
| 		utils.ExtraDataFlag, | ||||
| 		configFileFlag, | ||||
| 	} | ||||
|  | ||||
| @@ -324,7 +327,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { | ||||
| 	// Start auxiliary services if enabled | ||||
| 	if ctx.GlobalBool(utils.MiningEnabledFlag.Name) || ctx.GlobalBool(utils.DeveloperFlag.Name) { | ||||
| 		// Mining only makes sense if a full Ethereum node is running | ||||
| 		if ctx.GlobalBool(utils.LightModeFlag.Name) || ctx.GlobalString(utils.SyncModeFlag.Name) == "light" { | ||||
| 		if ctx.GlobalString(utils.SyncModeFlag.Name) == "light" { | ||||
| 			utils.Fatalf("Light clients do not support mining") | ||||
| 		} | ||||
| 		var ethereum *eth.Ethereum | ||||
| @@ -332,7 +335,11 @@ func startNode(ctx *cli.Context, stack *node.Node) { | ||||
| 			utils.Fatalf("Ethereum service not running: %v", err) | ||||
| 		} | ||||
| 		// Use a reduced number of threads if requested | ||||
| 		if threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name); threads > 0 { | ||||
| 		threads := ctx.GlobalInt(utils.MinerLegacyThreadsFlag.Name) | ||||
| 		if ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) { | ||||
| 			threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name) | ||||
| 		} | ||||
| 		if threads > 0 { | ||||
| 			type threaded interface { | ||||
| 				SetThreads(threads int) | ||||
| 			} | ||||
| @@ -341,7 +348,11 @@ func startNode(ctx *cli.Context, stack *node.Node) { | ||||
| 			} | ||||
| 		} | ||||
| 		// Set the gas price to the limits from the CLI and start mining | ||||
| 		ethereum.TxPool().SetGasPrice(utils.GlobalBig(ctx, utils.GasPriceFlag.Name)) | ||||
| 		gasprice := utils.GlobalBig(ctx, utils.MinerLegacyGasPriceFlag.Name) | ||||
| 		if ctx.IsSet(utils.MinerGasPriceFlag.Name) { | ||||
| 			gasprice = utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name) | ||||
| 		} | ||||
| 		ethereum.TxPool().SetGasPrice(gasprice) | ||||
| 		if err := ethereum.StartMining(true); err != nil { | ||||
| 			utils.Fatalf("Failed to start mining: %v", err) | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user