|
|
@ -252,10 +252,12 @@ func startNode(ctx *cli.Context, stack *node.Node) { |
|
|
|
}() |
|
|
|
}() |
|
|
|
// Start auxiliary services if enabled
|
|
|
|
// Start auxiliary services if enabled
|
|
|
|
if ctx.GlobalBool(utils.MiningEnabledFlag.Name) { |
|
|
|
if ctx.GlobalBool(utils.MiningEnabledFlag.Name) { |
|
|
|
|
|
|
|
// Mining only makes sense if a full Ethereum node is running
|
|
|
|
var ethereum *eth.Ethereum |
|
|
|
var ethereum *eth.Ethereum |
|
|
|
if err := stack.Service(ðereum); err != nil { |
|
|
|
if err := stack.Service(ðereum); err != nil { |
|
|
|
utils.Fatalf("ethereum service not running: %v", err) |
|
|
|
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 { |
|
|
|
if threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name); threads > 0 { |
|
|
|
type threaded interface { |
|
|
|
type threaded interface { |
|
|
|
SetThreads(threads int) |
|
|
|
SetThreads(threads int) |
|
|
@ -264,6 +266,8 @@ func startNode(ctx *cli.Context, stack *node.Node) { |
|
|
|
th.SetThreads(threads) |
|
|
|
th.SetThreads(threads) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Set the gas price to the limits from the CLI and start mining
|
|
|
|
|
|
|
|
ethereum.TxPool().SetGasPrice(utils.GlobalBig(ctx, utils.GasPriceFlag.Name)) |
|
|
|
if err := ethereum.StartMining(true); err != nil { |
|
|
|
if err := ethereum.StartMining(true); err != nil { |
|
|
|
utils.Fatalf("Failed to start mining: %v", err) |
|
|
|
utils.Fatalf("Failed to start mining: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|