Skip to content

Commit c98d9b4

Browse files
authored
Merge pull request ethereum#14677 from karalabe/miner-cli-gasprice
cmd/geth: corrently init gas price for CLI CPU mining
2 parents 0042f13 + d432688 commit c98d9b4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/geth/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,12 @@ func startNode(ctx *cli.Context, stack *node.Node) {
252252
}()
253253
// Start auxiliary services if enabled
254254
if ctx.GlobalBool(utils.MiningEnabledFlag.Name) {
255+
// Mining only makes sense if a full Ethereum node is running
255256
var ethereum *eth.Ethereum
256257
if err := stack.Service(&ethereum); err != nil {
257258
utils.Fatalf("ethereum service not running: %v", err)
258259
}
260+
// Use a reduced number of threads if requested
259261
if threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name); threads > 0 {
260262
type threaded interface {
261263
SetThreads(threads int)
@@ -264,6 +266,8 @@ func startNode(ctx *cli.Context, stack *node.Node) {
264266
th.SetThreads(threads)
265267
}
266268
}
269+
// Set the gas price to the limits from the CLI and start mining
270+
ethereum.TxPool().SetGasPrice(utils.GlobalBig(ctx, utils.GasPriceFlag.Name))
267271
if err := ethereum.StartMining(true); err != nil {
268272
utils.Fatalf("Failed to start mining: %v", err)
269273
}

0 commit comments

Comments
 (0)