diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-23 16:35:42 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-23 16:35:42 +0800 |
commit | ab6311c1bd38c2c90fb353bbf512f12777fd15f4 (patch) | |
tree | 67789a411277b767109f4fbc84e84d6f36f21adf /rpc | |
parent | d76e8cb1f126bf1f899507b6a43e4ecb4a798e54 (diff) | |
download | dexon-ab6311c1bd38c2c90fb353bbf512f12777fd15f4.tar.gz dexon-ab6311c1bd38c2c90fb353bbf512f12777fd15f4.tar.zst dexon-ab6311c1bd38c2c90fb353bbf512f12777fd15f4.zip |
Move remote mining agent to XEth
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/api.go | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/rpc/api.go b/rpc/api.go index 26330b124..427032995 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -17,20 +17,15 @@ type EthereumApi struct { eth *xeth.XEth xethMu sync.RWMutex db common.Database - - // Miner agent - agent *Agent } func NewEthereumApi(xeth *xeth.XEth, dataDir string) *EthereumApi { // What about when dataDir is empty? db, _ := ethdb.NewLDBDatabase(path.Join(dataDir, "dapps")) api := &EthereumApi{ - eth: xeth, - db: db, - agent: NewAgent(), + eth: xeth, + db: db, } - xeth.Backend().Miner().Register(api.agent) return api } @@ -349,13 +344,13 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err *reply = NewLogsRes(api.xeth().AllLogs(opts)) case "eth_getWork": api.xeth().SetMining(true) - *reply = api.agent.GetWork() + *reply = api.xeth().RemoteMining().GetWork() case "eth_submitWork": args := new(SubmitWorkArgs) if err := json.Unmarshal(req.Params, &args); err != nil { return err } - *reply = api.agent.SetResult(args.Nonce, args.Digest, args.Header) + *reply = api.xeth().RemoteMining().SubmitWork(args.Nonce, args.Digest, args.Header) case "db_putString": args := new(DbArgs) if err := json.Unmarshal(req.Params, &args); err != nil { |