aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-04 00:56:36 +0800
committerobscuren <geffobscura@gmail.com>2015-03-04 00:56:36 +0800
commit40ff3cac3943ee672d818776fdd8235fc6684dca (patch)
treee32f82689b0c669d61688470af5e92c2eda44d34 /cmd
parent53b5a45856c5d4c307dc55b4ae1b46efd9471142 (diff)
parent6e50a1e9f59532671eaa2bb2f2081a67f659bd0d (diff)
downloadgo-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.tar
go-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.tar.gz
go-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.tar.bz2
go-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.tar.lz
go-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.tar.xz
go-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.tar.zst
go-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.zip
merge
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ethereum/flags.go73
-rw-r--r--cmd/ethereum/main.go35
-rw-r--r--cmd/mist/flags.go52
-rw-r--r--cmd/mist/main.go2
-rw-r--r--cmd/utils/cmd.go4
5 files changed, 89 insertions, 77 deletions
diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go
index c42083160..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"
@@ -36,40 +37,42 @@ 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
+ MinerThreads int
)
// flags specific to cli client
@@ -93,6 +96,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")
@@ -119,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 dc25e4ae0..9d78b6282 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(&eth.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 {
@@ -128,7 +129,7 @@ func main() {
}
if StartRpc {
- utils.StartRpc(ethereum, RpcPort)
+ utils.StartRpc(ethereum, RpcListenAddress, RpcPort)
}
if StartWebSockets {
@@ -139,6 +140,10 @@ func main() {
fmt.Printf("Welcome to the FRONTIER\n")
+ if StartMining {
+ ethereum.Miner().Start()
+ }
+
if StartJsConsole {
InitJsConsole(ethereum)
} else if len(InputFile) > 0 {
diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go
index 0010df826..1ffeb1915 100644
--- a/cmd/mist/flags.go
+++ b/cmd/mist/flags.go
@@ -37,31 +37,32 @@ import (
)
var (
- Identifier string
- KeyRing 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
- VmType int
- MinerThreads int
+ Identifier string
+ KeyRing 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
+ VmType int
+ MinerThreads int
)
// flags specific to gui client
@@ -79,6 +80,7 @@ func Init() {
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(&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", true, "start rpc server")
diff --git a/cmd/mist/main.go b/cmd/mist/main.go
index 3abe16767..c9a07bfde 100644
--- a/cmd/mist/main.go
+++ b/cmd/mist/main.go
@@ -73,7 +73,7 @@ func run() error {
utils.KeyTasks(ethereum.KeyManager(), KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive)
if StartRpc {
- utils.StartRpc(ethereum, RpcPort)
+ utils.StartRpc(ethereum, RpcListenAddress, RpcPort)
}
if StartWebSockets {
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index 03ad883d7..794753f11 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -159,9 +159,9 @@ func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, Secre
clilogger.Infof("Main address %x\n", keyManager.Address())
}
-func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
+func StartRpc(ethereum *eth.Ethereum, RpcListenAddress string, RpcPort int) {
var err error
- ethereum.RpcServer, err = rpchttp.NewRpcHttpServer(xeth.New(ethereum), RpcPort)
+ ethereum.RpcServer, err = rpchttp.NewRpcHttpServer(xeth.New(ethereum), RpcListenAddress, RpcPort)
if err != nil {
clilogger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err)
} else {