aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/eth_args.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-08-06 17:58:14 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-06 18:58:54 +0800
commitc32073b11f12c3735c117b3b3c814505974d5a92 (patch)
treecfe83a65139ae8160dc7d1bbed8e22c56050bfd3 /rpc/api/eth_args.go
parent82ef26f6007986debd6ce082f57050f0c7e36006 (diff)
downloadgo-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.tar
go-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.tar.gz
go-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.tar.bz2
go-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.tar.lz
go-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.tar.xz
go-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.tar.zst
go-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.zip
miner, rpc: added submit hashrate for remote agents
Diffstat (limited to 'rpc/api/eth_args.go')
-rw-r--r--rpc/api/eth_args.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go
index 1218bd625..5a1841cbe 100644
--- a/rpc/api/eth_args.go
+++ b/rpc/api/eth_args.go
@@ -169,6 +169,37 @@ func (args *GetTxCountArgs) UnmarshalJSON(b []byte) (err error) {
return nil
}
+type SubmitHashRateArgs struct {
+ Id string
+ Rate uint64
+}
+
+func (args *SubmitHashRateArgs) UnmarshalJSON(b []byte) (err error) {
+ var obj []interface{}
+ if err := json.Unmarshal(b, &obj); err != nil {
+ return shared.NewDecodeParamError(err.Error())
+ }
+
+ if len(obj) < 2 {
+ return shared.NewInsufficientParamsError(len(obj), 2)
+ }
+
+ arg0, ok := obj[0].(string)
+ if !ok {
+ return shared.NewInvalidTypeError("hash", "not a string")
+ }
+ args.Id = arg0
+
+ arg1, ok := obj[1].(string)
+ if !ok {
+ return shared.NewInvalidTypeError("rate", "not a string")
+ }
+
+ args.Rate = common.String2Big(arg1).Uint64()
+
+ return nil
+}
+
type HashArgs struct {
Hash string
}