diff options
Diffstat (limited to 'cmd/geth/admin.go')
-rw-r--r-- | cmd/geth/admin.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go index 17d711297..b0cb7507a 100644 --- a/cmd/geth/admin.go +++ b/cmd/geth/admin.go @@ -275,10 +275,19 @@ func (js *jsre) verbosity(call otto.FunctionCall) otto.Value { } func (js *jsre) startMining(call otto.FunctionCall) otto.Value { - threads, err := call.Argument(0).ToInteger() - if err != nil { - fmt.Println(err) - return otto.FalseValue() + var ( + threads int64 + err error + ) + + if len(call.ArgumentList) > 0 { + threads, err = call.Argument(0).ToInteger() + if err != nil { + fmt.Println(err) + return otto.FalseValue() + } + } else { + threads = 4 } err = js.ethereum.StartMining(int(threads)) |