diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-23 15:28:54 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-23 15:28:54 +0800 |
commit | 372e1cad5bf02b83fd3c0becc442a5f5817f9d36 (patch) | |
tree | cea510b7e0f175d67fba39d1b4807eb835fa8af3 /rpc/api.go | |
parent | 8affdf96e23f092b7fe24d168b024b10eab35e05 (diff) | |
download | dexon-372e1cad5bf02b83fd3c0becc442a5f5817f9d36.tar.gz dexon-372e1cad5bf02b83fd3c0becc442a5f5817f9d36.tar.zst dexon-372e1cad5bf02b83fd3c0becc442a5f5817f9d36.zip |
Cleanup get/submitWork
getWork needs to return additional values
Diffstat (limited to 'rpc/api.go')
-rw-r--r-- | rpc/api.go | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/rpc/api.go b/rpc/api.go index d5e18eec8..1102b7cb2 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -348,13 +348,14 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error opts := toFilterOptions(args) *reply = NewLogsRes(p.xeth().AllLogs(opts)) case "eth_getWork": - *reply = p.getWork() + p.xeth().SetMining(true) + *reply = p.agent.GetWork().Hex() case "eth_submitWork": - // TODO what is the reply here? - // TODO what are the arguments? - p.agent.SetResult(0, common.Hash{}, common.Hash{}) - - return NewNotImplementedError(req.Method) + args := new(SubmitWorkArgs) + if err := json.Unmarshal(req.Params, &args); err != nil { + return err + } + *reply = p.agent.SetResult(args.Nonce, args.Digest, args.Header) case "db_putString": args := new(DbArgs) if err := json.Unmarshal(req.Params, &args); err != nil { @@ -466,11 +467,6 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error return nil } -func (p *EthereumApi) getWork() string { - p.xeth().SetMining(true) - return p.agent.GetWork().Hex() -} - func toFilterOptions(options *BlockFilterArgs) *core.FilterOptions { var opts core.FilterOptions |