Initial getTransactionReceipt support

This commit is contained in:
Taylor Gerring
2015-07-03 11:20:07 -05:00
parent 6f69b4d61f
commit 3a983d2419
2 changed files with 43 additions and 0 deletions

View File

@ -77,6 +77,7 @@ var (
"eth_submitWork": (*ethApi).SubmitWork,
"eth_resend": (*ethApi).Resend,
"eth_pendingTransactions": (*ethApi).PendingTransactions,
"eth_getTransactionReceipt": (*ethApi).GetTransactionReceipt,
}
)
@ -596,3 +597,22 @@ func (self *ethApi) PendingTransactions(req *shared.Request) (interface{}, error
return ltxs, nil
}
func (self *ethApi) GetTransactionReceipt(req *shared.Request) (interface{}, error) {
args := new(HashArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, shared.NewDecodeParamError(err.Error())
}
rec, _ := self.xeth.GetTxReceipt(common.StringToHash(args.Hash))
// We could have an error of "not found". Should disambiguate
// if err != nil {
// return err, nil
// }
if rec != nil {
v := NewReceiptRes(rec)
return v, nil
}
return nil, nil
}