diff options
Diffstat (limited to 'cmd/utils/cmd.go')
-rw-r--r-- | cmd/utils/cmd.go | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index a57d3266f..ecb847fc3 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -38,7 +38,8 @@ import ( "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" + rpchttp "github.com/ethereum/go-ethereum/rpc/http" + rpcws "github.com/ethereum/go-ethereum/rpc/ws" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/xeth" ) @@ -120,13 +121,11 @@ func exit(err error) { os.Exit(status) } -func StartEthereum(ethereum *eth.Ethereum, UseSeed bool) { - clilogger.Infof("Starting %s", ethereum.ClientIdentity()) - err := ethereum.Start(UseSeed) - if err != nil { +func StartEthereum(ethereum *eth.Ethereum) { + clilogger.Infoln("Starting ", ethereum.Name()) + if err := ethereum.Start(); err != nil { exit(err) } - RegisterInterrupt(func(sig os.Signal) { ethereum.Stop() logger.Flush() @@ -192,7 +191,7 @@ func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, Secre func StartRpc(ethereum *eth.Ethereum, RpcPort int) { var err error - ethereum.RpcServer, err = rpc.NewJsonRpcServer(xeth.NewJSXEth(ethereum), RpcPort) + ethereum.RpcServer, err = rpchttp.NewRpcHttpServer(xeth.New(ethereum), RpcPort) if err != nil { clilogger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err) } else { @@ -200,6 +199,18 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) { } } +func StartWebSockets(eth *eth.Ethereum, wsPort int) { + clilogger.Infoln("Starting WebSockets") + + var err error + eth.WsServer, err = rpcws.NewWebSocketServer(xeth.New(eth), wsPort) + if err != nil { + clilogger.Errorf("Could not start RPC interface (port %v): %v", wsPort, err) + } else { + go eth.WsServer.Start() + } +} + var gminer *miner.Miner func GetMiner() *miner.Miner { |