From b15425411b4d467191de39d1084f458c868f5eef Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 6 Jun 2017 10:18:26 -0400 Subject: [PATCH] dcrjson: Remove unnecessary verbose optional parameters. --- dcrjson/walletsvrcmds.go | 9 ++------- dcrjson/walletsvrcmds_test.go | 20 ++++++++------------ glide.lock | 4 ++-- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/dcrjson/walletsvrcmds.go b/dcrjson/walletsvrcmds.go index 0c75646020..55daee6894 100644 --- a/dcrjson/walletsvrcmds.go +++ b/dcrjson/walletsvrcmds.go @@ -142,7 +142,6 @@ func NewGetBalanceCmd(account *string, minConf *int) *GetBalanceCmd { // GetNewAddressCmd defines the getnewaddress JSON-RPC command. type GetNewAddressCmd struct { Account *string - Verbose *bool `jsonrpcdefault:"false"` } // NewGetNewAddressCmd returns a new instance which can be used to issue a @@ -150,17 +149,15 @@ type GetNewAddressCmd struct { // // The parameters which are pointers indicate they are optional. Passing nil // for optional parameters will use the default value. -func NewGetNewAddressCmd(account *string, verbose *bool) *GetNewAddressCmd { +func NewGetNewAddressCmd(account *string) *GetNewAddressCmd { return &GetNewAddressCmd{ Account: account, - Verbose: verbose, } } // GetRawChangeAddressCmd defines the getrawchangeaddress JSON-RPC command. type GetRawChangeAddressCmd struct { Account *string - Verbose *bool `jsonrpcdefault:"false"` } // NewGetRawChangeAddressCmd returns a new instance which can be used to issue a @@ -168,11 +165,9 @@ type GetRawChangeAddressCmd struct { // // The parameters which are pointers indicate they are optional. Passing nil // for optional parameters will use the default value. -func NewGetRawChangeAddressCmd(account *string, - verbose *bool) *GetRawChangeAddressCmd { +func NewGetRawChangeAddressCmd(account *string) *GetRawChangeAddressCmd { return &GetRawChangeAddressCmd{ Account: account, - Verbose: verbose, } } diff --git a/dcrjson/walletsvrcmds_test.go b/dcrjson/walletsvrcmds_test.go index 4a788487a2..0d88222a80 100644 --- a/dcrjson/walletsvrcmds_test.go +++ b/dcrjson/walletsvrcmds_test.go @@ -216,26 +216,24 @@ func TestWalletSvrCmds(t *testing.T) { return dcrjson.NewCmd("getnewaddress") }, staticCmd: func() interface{} { - return dcrjson.NewGetNewAddressCmd(nil, nil) + return dcrjson.NewGetNewAddressCmd(nil) }, marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":[],"id":1}`, unmarshalled: &dcrjson.GetNewAddressCmd{ Account: nil, - Verbose: dcrjson.Bool(false), }, }, { name: "getnewaddress optional", newCmd: func() (interface{}, error) { - return dcrjson.NewCmd("getnewaddress", "acct", "true") + return dcrjson.NewCmd("getnewaddress", "acct") }, staticCmd: func() interface{} { - return dcrjson.NewGetNewAddressCmd(dcrjson.String("acct"), dcrjson.Bool(true)) + return dcrjson.NewGetNewAddressCmd(dcrjson.String("acct")) }, - marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":["acct",true],"id":1}`, + marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":["acct"],"id":1}`, unmarshalled: &dcrjson.GetNewAddressCmd{ Account: dcrjson.String("acct"), - Verbose: dcrjson.Bool(true), }, }, { @@ -244,26 +242,24 @@ func TestWalletSvrCmds(t *testing.T) { return dcrjson.NewCmd("getrawchangeaddress") }, staticCmd: func() interface{} { - return dcrjson.NewGetRawChangeAddressCmd(nil, nil) + return dcrjson.NewGetRawChangeAddressCmd(nil) }, marshalled: `{"jsonrpc":"1.0","method":"getrawchangeaddress","params":[],"id":1}`, unmarshalled: &dcrjson.GetRawChangeAddressCmd{ Account: nil, - Verbose: dcrjson.Bool(false), }, }, { name: "getrawchangeaddress optional", newCmd: func() (interface{}, error) { - return dcrjson.NewCmd("getrawchangeaddress", "acct", "true") + return dcrjson.NewCmd("getrawchangeaddress", "acct") }, staticCmd: func() interface{} { - return dcrjson.NewGetRawChangeAddressCmd(dcrjson.String("acct"), dcrjson.Bool(true)) + return dcrjson.NewGetRawChangeAddressCmd(dcrjson.String("acct")) }, - marshalled: `{"jsonrpc":"1.0","method":"getrawchangeaddress","params":["acct",true],"id":1}`, + marshalled: `{"jsonrpc":"1.0","method":"getrawchangeaddress","params":["acct"],"id":1}`, unmarshalled: &dcrjson.GetRawChangeAddressCmd{ Account: dcrjson.String("acct"), - Verbose: dcrjson.Bool(true), }, }, { diff --git a/glide.lock b/glide.lock index ce3d58f4a9..a98f317069 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ hash: 134468fdfb2f19fa76447939a94e40512c3891b8f0a8e1f1fa2b70bcbd40bdf4 -updated: 2017-05-31T22:00:42.668930312-04:00 +updated: 2017-06-06T10:17:24.0166586-04:00 imports: - name: github.com/agl/ed25519 version: 278e1ec8e8a6e017cd07577924d6766039146ced @@ -51,7 +51,7 @@ imports: - name: github.com/decred/blake256 version: a840e32d7c31fe2e0218607334cb120a683951a4 - name: github.com/decred/dcrrpcclient - version: 7208596a68e5114e0c27d08b26c69cf38ccd1ee2 + version: 298b75929e994406aee5499af2ccabd894c9a4fd - name: github.com/decred/dcrutil version: f3e368a4178919ac884566084ece536c791cce52 subpackages: