aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/args.go8
-rw-r--r--rpc/args_test.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/rpc/args.go b/rpc/args.go
index 9f99456e6..7694a3d3f 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -535,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
}
diff --git a/rpc/args_test.go b/rpc/args_test.go
index e78981a41..9e0cf179f 100644
--- a/rpc/args_test.go
+++ b/rpc/args_test.go
@@ -2264,7 +2264,7 @@ func TestBlockNumIndexArgsBlocknumInvalid(t *testing.T) {
}
func TestBlockNumIndexArgsIndexInvalid(t *testing.T) {
- input := `["0x29a", 1]`
+ input := `["0x29a", true]`
args := new(BlockNumIndexArgs)
str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), &args))