From 3fcef54f9b81b49f7af2f06a231cd7e44ea851ba Mon Sep 17 00:00:00 2001
From: Taylor Gerring <taylor.gerring@gmail.com>
Date: Thu, 26 Mar 2015 22:58:12 +0100
Subject: [PATCH] tidy

---
 rpc/args.go      | 13 ++++++++++++-
 rpc/args_test.go | 11 +++--------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/rpc/args.go b/rpc/args.go
index 65707aa372..806efb9ccc 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -29,7 +29,7 @@ func blockHeight(raw interface{}, number *int64) error {
 	// Parse as string/hexstring
 	str, ok := raw.(string)
 	if !ok {
-		return NewInvalidTypeError("blockNumber", "not a number or string")
+		return NewInvalidTypeError("", "not a number or string")
 	}
 
 	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 {
 	BlockHash  string
 	IncludeTxs bool
diff --git a/rpc/args_test.go b/rpc/args_test.go
index c5d407c973..b658eed68e 100644
--- a/rpc/args_test.go
+++ b/rpc/args_test.go
@@ -155,14 +155,9 @@ func TestGetBalanceArgsInvalid(t *testing.T) {
 	input := `6`
 
 	args := new(GetBalanceArgs)
-	err := json.Unmarshal([]byte(input), &args)
-	switch err.(type) {
-	case nil:
-		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())
+	str := ExpectDecodeParamError(json.Unmarshal([]byte(input), &args))
+	if len(str) > 0 {
+		t.Error(str)
 	}
 }
 
-- 
GitLab