Commit 6512b23b authored by zelig's avatar zelig

cli: fatal error if rpc could not be started

parent 7b2f25b5
...@@ -354,7 +354,9 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) { ...@@ -354,7 +354,9 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
} }
// Start auxiliary services if enabled. // Start auxiliary services if enabled.
if ctx.GlobalBool(utils.RPCEnabledFlag.Name) { if ctx.GlobalBool(utils.RPCEnabledFlag.Name) {
utils.StartRPC(eth, ctx) if err := utils.StartRPC(eth, ctx); err != nil {
utils.Fatalf("Error starting RPC: %v", err)
}
} }
if ctx.GlobalBool(utils.MiningEnabledFlag.Name) { if ctx.GlobalBool(utils.MiningEnabledFlag.Name) {
eth.StartMining() eth.StartMining()
......
...@@ -330,7 +330,7 @@ func GetAccountManager(ctx *cli.Context) *accounts.Manager { ...@@ -330,7 +330,7 @@ func GetAccountManager(ctx *cli.Context) *accounts.Manager {
return accounts.NewManager(ks) return accounts.NewManager(ks)
} }
func StartRPC(eth *eth.Ethereum, ctx *cli.Context) { func StartRPC(eth *eth.Ethereum, ctx *cli.Context) error {
config := rpc.RpcConfig{ config := rpc.RpcConfig{
ListenAddress: ctx.GlobalString(RPCListenAddrFlag.Name), ListenAddress: ctx.GlobalString(RPCListenAddrFlag.Name),
ListenPort: uint(ctx.GlobalInt(RPCPortFlag.Name)), ListenPort: uint(ctx.GlobalInt(RPCPortFlag.Name)),
...@@ -338,7 +338,7 @@ func StartRPC(eth *eth.Ethereum, ctx *cli.Context) { ...@@ -338,7 +338,7 @@ func StartRPC(eth *eth.Ethereum, ctx *cli.Context) {
} }
xeth := xeth.New(eth, nil) xeth := xeth.New(eth, nil)
_ = rpc.Start(xeth, config) return rpc.Start(xeth, config)
} }
func StartPProf(ctx *cli.Context) { func StartPProf(ctx *cli.Context) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment