aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-14 19:32:49 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-14 19:32:49 +0800
commit9fce273ce97a8db091a0bf9d0b503a2ea7261f81 (patch)
treee1d0dd2abebb0d363d47a5722579bad0146b72da /utils
parent2012e0c67abd8e3012a3eb1fae2e282e2a442d01 (diff)
downloaddexon-9fce273ce97a8db091a0bf9d0b503a2ea7261f81.tar.gz
dexon-9fce273ce97a8db091a0bf9d0b503a2ea7261f81.tar.zst
dexon-9fce273ce97a8db091a0bf9d0b503a2ea7261f81.zip
Refactored RPC client to utils so it can be reused
Diffstat (limited to 'utils')
-rw-r--r--utils/cmd.go13
1 files changed, 12 insertions, 1 deletions
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