tidy
This commit is contained in:
parent
6bd1f6cc49
commit
3fcef54f9b
13
rpc/args.go
13
rpc/args.go
|
@ -29,7 +29,7 @@ func blockHeight(raw interface{}, number *int64) error {
|
||||||
// Parse as string/hexstring
|
// Parse as string/hexstring
|
||||||
str, ok := raw.(string)
|
str, ok := raw.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
return NewInvalidTypeError("blockNumber", "not a number or string")
|
return NewInvalidTypeError("", "not a number or string")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch str {
|
switch str {
|
||||||
|
@ -82,6 +82,17 @@ func numString(raw interface{}, number *int64) error {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// func hashString(raw interface{}, hash *string) error {
|
||||||
|
// argstr, ok := raw.(string)
|
||||||
|
// if !ok {
|
||||||
|
// return NewInvalidTypeError("", "not a string")
|
||||||
|
// }
|
||||||
|
// v := common.IsHex(argstr)
|
||||||
|
// hash = &argstr
|
||||||
|
|
||||||
|
// return nil
|
||||||
|
// }
|
||||||
|
|
||||||
type GetBlockByHashArgs struct {
|
type GetBlockByHashArgs struct {
|
||||||
BlockHash string
|
BlockHash string
|
||||||
IncludeTxs bool
|
IncludeTxs bool
|
||||||
|
|
|
@ -155,14 +155,9 @@ func TestGetBalanceArgsInvalid(t *testing.T) {
|
||||||
input := `6`
|
input := `6`
|
||||||
|
|
||||||
args := new(GetBalanceArgs)
|
args := new(GetBalanceArgs)
|
||||||
err := json.Unmarshal([]byte(input), &args)
|
str := ExpectDecodeParamError(json.Unmarshal([]byte(input), &args))
|
||||||
switch err.(type) {
|
if len(str) > 0 {
|
||||||
case nil:
|
t.Error(str)
|
||||||
t.Error("Expected error but didn't get one")
|
|
||||||
case *DecodeParamError:
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
t.Errorf("Expected *rpc.DecodeParamError but got %T with message %s", err, err.Error())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue