From f6e821fd335911c26d515094ac0af4fa69526279 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sat, 28 Feb 2015 01:00:42 +0100 Subject: Add flag to set RPC port --- cmd/ethereum/flags.go | 70 ++++++++++++++++++++++++++------------------------- cmd/ethereum/main.go | 2 +- 2 files changed, 37 insertions(+), 35 deletions(-) (limited to 'cmd/ethereum') diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 7d410c8e4..79a60039c 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -36,40 +36,41 @@ import ( ) 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 + 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 ) // flags specific to cli client @@ -93,6 +94,7 @@ func Init() { flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use") flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)") + 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") diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 45e6f7b93..8afab5d28 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -128,7 +128,7 @@ func main() { } if StartRpc { - utils.StartRpc(ethereum, RpcPort) + utils.StartRpc(ethereum, RpcListenAddress, RpcPort) } if StartWebSockets { -- cgit v1.2.3 From 6ea7aae29ca71e6fe857b85296b574e09df57184 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 28 Feb 2015 19:15:57 +0100 Subject: Removed some methods from the JS REPL --- cmd/ethereum/flags.go | 6 ++++++ cmd/ethereum/main.go | 3 +++ cmd/ethereum/repl/repl.go | 1 + 3 files changed, 10 insertions(+) (limited to 'cmd/ethereum') diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 7d410c8e4..c42083160 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -135,6 +135,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) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 45e6f7b93..1562165cd 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -137,6 +137,9 @@ func main() { utils.StartEthereum(ethereum) + latestBlock := ethereum.ChainManager().CurrentBlock() + fmt.Printf("Welcome to the FRONTIER\n") + if StartJsConsole { InitJsConsole(ethereum) } else if len(InputFile) > 0 { diff --git a/cmd/ethereum/repl/repl.go b/cmd/ethereum/repl/repl.go index 4a7880ff4..11b812617 100644 --- a/cmd/ethereum/repl/repl.go +++ b/cmd/ethereum/repl/repl.go @@ -60,6 +60,7 @@ func (self *JSRepl) Start() { if !self.running { self.running = true repllogger.Infoln("init JS Console") + reader := bufio.NewReader(self.history) for { line, err := reader.ReadString('\n') -- cgit v1.2.3 From 7ab13e0f17e9d1b783d93bd4952cc6d7cc77ea7f Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 28 Feb 2015 20:24:20 +0100 Subject: Unused variable --- cmd/ethereum/main.go | 1 - 1 file changed, 1 deletion(-) (limited to 'cmd/ethereum') diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 1562165cd..f72b11e14 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -137,7 +137,6 @@ func main() { utils.StartEthereum(ethereum) - latestBlock := ethereum.ChainManager().CurrentBlock() fmt.Printf("Welcome to the FRONTIER\n") if StartJsConsole { -- cgit v1.2.3 From fdf939a6f9b5360d76415c7118969d92af2774f9 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 28 Feb 2015 23:01:41 +0100 Subject: Fixed miner threads for ethereum CLI --- cmd/ethereum/flags.go | 3 +++ cmd/ethereum/main.go | 37 +++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'cmd/ethereum') diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 1a0c13c82..356571a23 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -27,6 +27,7 @@ import ( "log" "os" "path" + "runtime" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" @@ -71,6 +72,7 @@ var ( SHH bool Dial bool PrintVersion bool + MinerThreads int ) // flags specific to cli client @@ -121,6 +123,7 @@ func Init() { flag.BoolVar(&StartMining, "mine", false, "start dagger 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 ( diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 07ef0d5dd..f79f948d1 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -62,20 +62,21 @@ func main() { utils.InitConfig(VmType, ConfigFile, Datadir, "ETH") ethereum, err := eth.New(ð.Config{ - Name: p2p.MakeName(ClientIdentifier, Version), - KeyStore: KeyStore, - DataDir: Datadir, - LogFile: LogFile, - LogLevel: LogLevel, - LogFormat: LogFormat, - MaxPeers: MaxPeer, - Port: OutboundPort, - NAT: NAT, - KeyRing: KeyRing, - Shh: true, - Dial: Dial, - BootNodes: BootNodes, - NodeKey: NodeKey, + Name: p2p.MakeName(ClientIdentifier, Version), + KeyStore: KeyStore, + DataDir: Datadir, + LogFile: LogFile, + LogLevel: LogLevel, + LogFormat: LogFormat, + MaxPeers: MaxPeer, + Port: OutboundPort, + NAT: NAT, + KeyRing: KeyRing, + Shh: true, + Dial: Dial, + BootNodes: BootNodes, + NodeKey: NodeKey, + MinerThreads: MinerThreads, }) if err != nil { @@ -113,10 +114,6 @@ func main() { return } - if StartMining { - utils.StartMining(ethereum) - } - if len(ImportChain) > 0 { start := time.Now() err := utils.ImportChain(ethereum, ImportChain) @@ -139,6 +136,10 @@ func main() { fmt.Printf("Welcome to the FRONTIER\n") + if StartMining { + ethereum.Miner().Start() + } + if StartJsConsole { InitJsConsole(ethereum) } else if len(InputFile) > 0 { -- cgit v1.2.3