aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ethereal/ethereum.go9
-rw-r--r--ethereum/ethereum.go9
-rw-r--r--utils/cmd.go13
3 files changed, 14 insertions, 17 deletions
diff --git a/ethereal/ethereum.go b/ethereal/ethereum.go
index 32c16f64f..a97d7f498 100644
--- a/ethereal/ethereum.go
+++ b/ethereal/ethereum.go
@@ -4,8 +4,6 @@ import (
"fmt"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
- "github.com/ethereum/eth-go/ethpub"
- "github.com/ethereum/eth-go/ethrpc"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/ethereal/ui"
"github.com/ethereum/go-ethereum/utils"
@@ -104,12 +102,7 @@ func main() {
}
if StartRpc {
- ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort)
- if err != nil {
- log.Println("Could not start RPC interface:", err)
- } else {
- go ethereum.RpcServer.Start()
- }
+ utils.DoRpc(ethereum, RpcPort)
}
log.Printf("Starting Ethereum GUI v%s\n", ethutil.Config.Ver)
diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go
index 207e61c88..448223c37 100644
--- a/ethereum/ethereum.go
+++ b/ethereum/ethereum.go
@@ -4,8 +4,6 @@ import (
"fmt"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
- "github.com/ethereum/eth-go/ethpub"
- "github.com/ethereum/eth-go/ethrpc"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/utils"
"log"
@@ -139,12 +137,7 @@ func main() {
go console.Start()
}
if StartRpc {
- ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort)
- if err != nil {
- logger.Infoln("Could not start RPC interface:", err)
- } else {
- go ethereum.RpcServer.Start()
- }
+ utils.DoRpc(ethereum, RpcPort)
}
RegisterInterrupts(ethereum)
diff --git a/utils/cmd.go b/utils/cmd.go
index 44924ce91..5a100ca4f 100644
--- a/utils/cmd.go
+++ b/utils/cmd.go
@@ -5,12 +5,23 @@ import (
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethminer"
- _ "github.com/ethereum/eth-go/ethrpc"
+ "github.com/ethereum/eth-go/ethpub"
+ "github.com/ethereum/eth-go/ethrpc"
"github.com/ethereum/eth-go/ethutil"
"log"
"time"
)
+func DoRpc(ethereum *eth.Ethereum, RpcPort int) {
+ var err error
+ ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort)
+ if err != nil {
+ log.Println("Could not start RPC interface:", err)
+ } else {
+ go ethereum.RpcServer.Start()
+ }
+}
+
func DoMining(ethereum *eth.Ethereum) {
// Set Mining status
ethereum.Mining = true