aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/ethereum/flags.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/ethereum/flags.go')
-rw-r--r--cmd/ethereum/flags.go99
1 files changed, 51 insertions, 48 deletions
diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go
index 577bee442..a3004f503 100644
--- a/cmd/ethereum/flags.go
+++ b/cmd/ethereum/flags.go
@@ -26,50 +26,52 @@ import (
"fmt"
"log"
"os"
- "os/user"
"path"
+ "runtime"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/vm"
)
var (
- Identifier string
- KeyRing string
- DiffTool bool
- DiffType string
- KeyStore string
- StartRpc bool
- StartWebSockets bool
- RpcPort int
- WsPort int
- OutboundPort string
- ShowGenesis bool
- AddPeer string
- MaxPeer int
- GenAddr bool
- BootNodes string
- NodeKey *ecdsa.PrivateKey
- NAT nat.Interface
- SecretFile string
- ExportDir string
- NonInteractive bool
- Datadir string
- LogFile string
- ConfigFile string
- DebugFile string
- LogLevel int
- LogFormat string
- Dump bool
- DumpHash string
- DumpNumber int
- VmType int
- ImportChain string
- SHH bool
- Dial bool
- PrintVersion bool
+ Identifier string
+ KeyRing string
+ DiffTool bool
+ DiffType string
+ KeyStore string
+ StartRpc bool
+ StartWebSockets bool
+ RpcListenAddress string
+ RpcPort int
+ OutboundPort string
+ ShowGenesis bool
+ AddPeer string
+ MaxPeer int
+ GenAddr bool
+ BootNodes string
+ NodeKey *ecdsa.PrivateKey
+ NAT nat.Interface
+ SecretFile string
+ ExportDir string
+ NonInteractive bool
+ Datadir string
+ LogFile string
+ ConfigFile string
+ DebugFile string
+ LogLevel int
+ LogFormat string
+ Dump bool
+ DumpHash string
+ DumpNumber int
+ VmType int
+ ImportChain string
+ SHH bool
+ Dial bool
+ PrintVersion bool
+ MinerThreads int
)
// flags specific to cli client
@@ -79,12 +81,7 @@ var (
InputFile string
)
-func defaultDataDir() string {
- usr, _ := user.Current()
- return path.Join(usr.HomeDir, ".ethereum")
-}
-
-var defaultConfigFile = path.Join(defaultDataDir(), "conf.ini")
+var defaultConfigFile = path.Join(ethutil.DefaultDataDir(), "conf.ini")
func Init() {
// TODO: move common flag processing to cmd/util
@@ -96,22 +93,21 @@ func Init() {
flag.IntVar(&VmType, "vm", 0, "Virtual Machine type: 0-1: standard, debug")
flag.StringVar(&Identifier, "id", "", "Custom client identifier")
flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use")
- flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)")
+ flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file")
+ flag.StringVar(&RpcListenAddress, "rpcaddr", "127.0.0.1", "address for json-rpc server to listen on")
flag.IntVar(&RpcPort, "rpcport", 8545, "port to start json-rpc server on")
- flag.IntVar(&WsPort, "wsport", 40404, "port to start websocket rpc server on")
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
- flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given")
flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)")
- flag.StringVar(&Datadir, "datadir", defaultDataDir(), "specifies the datadir to use")
+ flag.StringVar(&Datadir, "datadir", ethutil.DefaultDataDir(), "specifies the datadir to use")
flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file")
flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)")
- flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)")
- flag.StringVar(&LogFormat, "logformat", "std", "logformat: std,raw)")
+ flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5 (= silent,error,warn,info,debug,debug detail)")
+ flag.StringVar(&LogFormat, "logformat", "std", "logformat: std,raw")
flag.BoolVar(&DiffTool, "difftool", false, "creates output for diff'ing. Sets LogLevel=0")
flag.StringVar(&DiffType, "diff", "all", "sets the level of diff output [vm, all]. Has no effect if difftool=false")
flag.BoolVar(&ShowGenesis, "genesis", false, "Dump the genesis block")
@@ -121,9 +117,10 @@ func Init() {
flag.StringVar(&DumpHash, "hash", "", "specify arg in hex")
flag.IntVar(&DumpNumber, "number", -1, "specify arg in number")
- flag.BoolVar(&StartMining, "mine", false, "start dagger mining")
+ flag.BoolVar(&StartMining, "mine", false, "start mining")
flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console")
flag.BoolVar(&PrintVersion, "version", false, "prints version number")
+ flag.IntVar(&MinerThreads, "minerthreads", runtime.NumCPU(), "number of miner threads")
// Network stuff
var (
@@ -140,6 +137,12 @@ func Init() {
flag.Parse()
+ // When the javascript console is started log to a file instead
+ // of stdout
+ if StartJsConsole {
+ LogFile = path.Join(Datadir, "ethereum.log")
+ }
+
var err error
if NAT, err = nat.Parse(*natstr); err != nil {
log.Fatalf("-nat: %v", err)