good morning!!!!

Skip to content
Snippets Groups Projects
Commit 2ea22611 authored by Taylor Gerring's avatar Taylor Gerring
Browse files

Accept num or hex as index

parent 35ad9feb
No related branches found
No related tags found
No related merge requests found
...@@ -535,11 +535,11 @@ func (args *BlockNumIndexArgs) UnmarshalJSON(b []byte) (err error) { ...@@ -535,11 +535,11 @@ func (args *BlockNumIndexArgs) UnmarshalJSON(b []byte) (err error) {
return err return err
} }
arg1, ok := obj[1].(string) var arg1 *big.Int
if !ok { if arg1, err = numString(obj[1]); err != nil {
return NewInvalidTypeError("index", "not a string") return err
} }
args.Index = common.Big(arg1).Int64() args.Index = arg1.Int64()
return nil return nil
} }
......
...@@ -2264,7 +2264,7 @@ func TestBlockNumIndexArgsBlocknumInvalid(t *testing.T) { ...@@ -2264,7 +2264,7 @@ func TestBlockNumIndexArgsBlocknumInvalid(t *testing.T) {
} }
func TestBlockNumIndexArgsIndexInvalid(t *testing.T) { func TestBlockNumIndexArgsIndexInvalid(t *testing.T) {
input := `["0x29a", 1]` input := `["0x29a", true]`
args := new(BlockNumIndexArgs) args := new(BlockNumIndexArgs)
str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), &args)) str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), &args))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment