diff options
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 |