From e80ef9ff34562410fbab63ccf173b17508b026ed Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sat, 28 Mar 2015 21:41:34 +0100 Subject: [PATCH] Cleanup --- rpc/api.go | 1 - rpc/args.go | 21 +++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/rpc/api.go b/rpc/api.go index 05c264b6f2..5020791777 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -13,7 +13,6 @@ import ( type EthereumApi struct { eth *xeth.XEth xethMu sync.RWMutex - db common.Database } func NewEthereumApi(xeth *xeth.XEth) *EthereumApi { diff --git a/rpc/args.go b/rpc/args.go index a075f1a596..25a6c7a4f9 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -1,9 +1,7 @@ package rpc import ( - "bytes" "encoding/json" - // "errors" "fmt" "math/big" @@ -105,8 +103,8 @@ type GetBlockByHashArgs struct { func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) { var obj []interface{} - r := bytes.NewReader(b) - if err := json.NewDecoder(r).Decode(&obj); err != nil { + + if err := json.Unmarshal(b, &obj); err != nil { return NewDecodeParamError(err.Error()) } @@ -134,8 +132,7 @@ type GetBlockByNumberArgs struct { func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) { var obj []interface{} - r := bytes.NewReader(b) - if err := json.NewDecoder(r).Decode(&obj); err != nil { + if err := json.Unmarshal(b, &obj); err != nil { return NewDecodeParamError(err.Error()) } @@ -405,8 +402,7 @@ type BlockNumIndexArgs struct { func (args *BlockNumIndexArgs) UnmarshalJSON(b []byte) (err error) { var obj []interface{} - r := bytes.NewReader(b) - if err := json.NewDecoder(r).Decode(&obj); err != nil { + if err := json.Unmarshal(b, &obj); err != nil { return NewDecodeParamError(err.Error()) } @@ -436,8 +432,7 @@ type HashIndexArgs struct { func (args *HashIndexArgs) UnmarshalJSON(b []byte) (err error) { var obj []interface{} - r := bytes.NewReader(b) - if err := json.NewDecoder(r).Decode(&obj); err != nil { + if err := json.Unmarshal(b, &obj); err != nil { return NewDecodeParamError(err.Error()) } @@ -468,8 +463,7 @@ type Sha3Args struct { func (args *Sha3Args) UnmarshalJSON(b []byte) (err error) { var obj []interface{} - r := bytes.NewReader(b) - if err := json.NewDecoder(r).Decode(&obj); err != nil { + if err := json.Unmarshal(b, &obj); err != nil { return NewDecodeParamError(err.Error()) } @@ -798,8 +792,7 @@ type FilterStringArgs struct { func (args *FilterStringArgs) UnmarshalJSON(b []byte) (err error) { var obj []interface{} - r := bytes.NewReader(b) - if err := json.NewDecoder(r).Decode(&obj); err != nil { + if err := json.Unmarshal(b, &obj); err != nil { return NewDecodeParamError(err.Error()) }