diff options
author | Bas van Kervel <bas@ethdev.com> | 2015-06-10 17:29:52 +0800 |
---|---|---|
committer | Bas van Kervel <basvankervel@gmail.com> | 2015-06-11 20:01:41 +0800 |
commit | bd38428f33b127e9c60d26127695e50c55798fcd (patch) | |
tree | 9bb838822fc3d1b28775f57223a30a243d4df9f2 /rpc/api/miner_args.go | |
parent | 87b62f75a7b9c15c17f3352f1b50ad88966e7070 (diff) | |
download | go-tangerine-bd38428f33b127e9c60d26127695e50c55798fcd.tar.gz go-tangerine-bd38428f33b127e9c60d26127695e50c55798fcd.tar.zst go-tangerine-bd38428f33b127e9c60d26127695e50c55798fcd.zip |
cleanup of javascript API
Diffstat (limited to 'rpc/api/miner_args.go')
-rw-r--r-- | rpc/api/miner_args.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/rpc/api/miner_args.go b/rpc/api/miner_args.go index 6b3d16d48..7b0560c16 100644 --- a/rpc/api/miner_args.go +++ b/rpc/api/miner_args.go @@ -41,6 +41,10 @@ func (args *SetExtraArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewDecodeParamError(err.Error()) } + if len(obj) < 1 { + return shared.NewInsufficientParamsError(len(obj), 1) + } + extrastr, ok := obj[0].(string) if !ok { return shared.NewInvalidTypeError("Price", "not a string") @@ -60,13 +64,16 @@ func (args *GasPriceArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewDecodeParamError(err.Error()) } - pricestr, ok := obj[0].(string) - if !ok { - return shared.NewInvalidTypeError("Price", "not a string") + if len(obj) < 1 { + return shared.NewInsufficientParamsError(len(obj), 1) } - args.Price = pricestr - return nil + if pricestr, ok := obj[0].(string); ok { + args.Price = pricestr + return nil + } + + return shared.NewInvalidTypeError("Price", "not a string") } type MakeDAGArgs struct { |