aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args.go
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/args.go')
-rw-r--r--rpc/args.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/rpc/args.go b/rpc/args.go
index 70618a01a..cebabf4ba 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -41,7 +41,11 @@ func blockHeight(raw interface{}, number *int64) error {
case "pending":
*number = -2
default:
- *number = common.String2Big(str).Int64()
+ if common.HasHexPrefix(str) {
+ *number = common.String2Big(str).Int64()
+ } else {
+ return NewInvalidTypeError("blockNumber", "is not a valid string")
+ }
}
return nil
@@ -1021,12 +1025,15 @@ func (args *WhisperFilterArgs) UnmarshalJSON(b []byte) (err error) {
return NewInsufficientParamsError(len(obj), 1)
}
- var argstr string
- argstr, ok := obj[0].To.(string)
- if !ok {
- return NewInvalidTypeError("to", "is not a string")
+ if obj[0].To == nil {
+ args.To = ""
+ } else {
+ argstr, ok := obj[0].To.(string)
+ if !ok {
+ return NewInvalidTypeError("to", "is not a string")
+ }
+ args.To = argstr
}
- args.To = argstr
t := make([]string, len(obj[0].Topics))
for i, j := range obj[0].Topics {