aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args.go
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/args.go')
-rw-r--r--rpc/args.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/rpc/args.go b/rpc/args.go
index d31773ff7..7694a3d3f 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -145,12 +145,8 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) {
return NewInsufficientParamsError(len(obj), 2)
}
- if v, ok := obj[0].(float64); ok {
- args.BlockNumber = int64(v)
- } else if v, ok := obj[0].(string); ok {
- args.BlockNumber = common.Big(v).Int64()
- } else {
- return NewInvalidTypeError("blockNumber", "not a number or string")
+ if err := blockHeight(obj[0], &args.BlockNumber); err != nil {
+ return err
}
args.IncludeTxs = obj[1].(bool)
@@ -539,11 +535,11 @@ func (args *BlockNumIndexArgs) UnmarshalJSON(b []byte) (err error) {
return err
}
- arg1, ok := obj[1].(string)
- if !ok {
- return NewInvalidTypeError("index", "not a string")
+ var arg1 *big.Int
+ if arg1, err = numString(obj[1]); err != nil {
+ return err
}
- args.Index = common.Big(arg1).Int64()
+ args.Index = arg1.Int64()
return nil
}