Cleanup get/submitWork

getWork needs to return additional values
This commit is contained in:
Taylor Gerring
2015-03-23 08:28:54 +01:00
parent 8affdf96e2
commit 372e1cad5b
3 changed files with 54 additions and 12 deletions

View File

@ -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