diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-27 03:20:43 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-27 03:20:43 +0800 |
commit | b414a1303f33aef26b606367ac68163f9b6c87c8 (patch) | |
tree | 2d7d9ad091472ef9ccfd44b84f3cfaa752789afd /rpc/args.go | |
parent | 1f1e98f96b57c0c5c7a9350129f67d425a4c6af4 (diff) | |
download | dexon-b414a1303f33aef26b606367ac68163f9b6c87c8.tar.gz dexon-b414a1303f33aef26b606367ac68163f9b6c87c8.tar.zst dexon-b414a1303f33aef26b606367ac68163f9b6c87c8.zip |
WhisperIdentityArgs
Diffstat (limited to 'rpc/args.go')
-rw-r--r-- | rpc/args.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/rpc/args.go b/rpc/args.go index 921d8e98c..c11ffa3cc 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -687,9 +687,8 @@ type WhisperIdentityArgs struct { } func (args *WhisperIdentityArgs) UnmarshalJSON(b []byte) (err error) { - var obj []string - r := bytes.NewReader(b) - if err := json.NewDecoder(r).Decode(&obj); err != nil { + var obj []interface{} + if err := json.Unmarshal(b, &obj); err != nil { return NewDecodeParamError(err.Error()) } @@ -697,7 +696,14 @@ func (args *WhisperIdentityArgs) UnmarshalJSON(b []byte) (err error) { return NewInsufficientParamsError(len(obj), 1) } - args.Identity = obj[0] + argstr, ok := obj[0].(string) + if !ok { + return NewInvalidTypeError("arg0", "not a string") + } + // if !common.IsHex(argstr) { + // return NewValidationError("arg0", "not a hexstring") + // } + args.Identity = argstr return nil } |