Commit 719effa7 authored by Taylor Gerring's avatar Taylor Gerring

Return error when filter params are not strings

parent 03ac0f18
......@@ -359,24 +359,30 @@ func (args *FilterOptions) UnmarshalJSON(b []byte) (err error) {
}
fromstr, ok := obj[0].FromBlock.(string)
if ok {
if fromstr == "latest" {
if !ok {
return NewDecodeParamError("FromBlock is not a string")
}
switch fromstr {
case "latest":
args.Earliest = 0
} else {
default:
args.Earliest = int64(common.Big(obj[0].FromBlock.(string)).Int64())
}
}
tostr, ok := obj[0].ToBlock.(string)
if ok {
if tostr == "latest" {
if !ok {
return NewDecodeParamError("ToBlock is not a string")
}
switch tostr {
case "latest":
args.Latest = 0
} else if tostr == "pending" {
case "pending":
args.Latest = -1
} else {
default:
args.Latest = int64(common.Big(obj[0].ToBlock.(string)).Int64())
}
}
args.Max = int(common.Big(obj[0].Limit).Int64())
args.Skip = int(common.Big(obj[0].Offset).Int64())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment