From f01a8bfd7a16dc849cba5e07a54a5012c1e079fc Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 6 Jun 2017 15:01:41 -0400 Subject: [PATCH] dcrjson: Add gap policy option to getnewaddress. --- dcrjson/walletsvrcmds.go | 8 +++++--- dcrjson/walletsvrcmds_test.go | 14 ++++++++------ glide.lock | 8 ++++---- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/dcrjson/walletsvrcmds.go b/dcrjson/walletsvrcmds.go index 55daee6894..4c70ade936 100644 --- a/dcrjson/walletsvrcmds.go +++ b/dcrjson/walletsvrcmds.go @@ -141,7 +141,8 @@ func NewGetBalanceCmd(account *string, minConf *int) *GetBalanceCmd { // GetNewAddressCmd defines the getnewaddress JSON-RPC command. type GetNewAddressCmd struct { - Account *string + Account *string + GapPolicy *string } // NewGetNewAddressCmd returns a new instance which can be used to issue a @@ -149,9 +150,10 @@ 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) *GetNewAddressCmd { +func NewGetNewAddressCmd(account *string, gapPolicy *string) *GetNewAddressCmd { return &GetNewAddressCmd{ - Account: account, + Account: account, + GapPolicy: gapPolicy, } } diff --git a/dcrjson/walletsvrcmds_test.go b/dcrjson/walletsvrcmds_test.go index 0d88222a80..e7782a77ea 100644 --- a/dcrjson/walletsvrcmds_test.go +++ b/dcrjson/walletsvrcmds_test.go @@ -216,24 +216,26 @@ func TestWalletSvrCmds(t *testing.T) { return dcrjson.NewCmd("getnewaddress") }, staticCmd: func() interface{} { - return dcrjson.NewGetNewAddressCmd(nil) + return dcrjson.NewGetNewAddressCmd(nil, nil) }, marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":[],"id":1}`, unmarshalled: &dcrjson.GetNewAddressCmd{ - Account: nil, + Account: nil, + GapPolicy: nil, }, }, { name: "getnewaddress optional", newCmd: func() (interface{}, error) { - return dcrjson.NewCmd("getnewaddress", "acct") + return dcrjson.NewCmd("getnewaddress", "acct", "ignore") }, staticCmd: func() interface{} { - return dcrjson.NewGetNewAddressCmd(dcrjson.String("acct")) + return dcrjson.NewGetNewAddressCmd(dcrjson.String("acct"), dcrjson.String("ignore")) }, - marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":["acct"],"id":1}`, + marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":["acct","ignore"],"id":1}`, unmarshalled: &dcrjson.GetNewAddressCmd{ - Account: dcrjson.String("acct"), + Account: dcrjson.String("acct"), + GapPolicy: dcrjson.String("ignore"), }, }, { diff --git a/glide.lock b/glide.lock index a98f317069..e925f448e8 100644 --- a/glide.lock +++ b/glide.lock @@ -1,12 +1,12 @@ hash: 134468fdfb2f19fa76447939a94e40512c3891b8f0a8e1f1fa2b70bcbd40bdf4 -updated: 2017-06-06T10:17:24.0166586-04:00 +updated: 2017-06-06T15:00:47.0712938-04:00 imports: - name: github.com/agl/ed25519 version: 278e1ec8e8a6e017cd07577924d6766039146ced subpackages: - edwards25519 - name: github.com/btcsuite/btclog - version: 73889fb79bd687870312b6e40effcecffbd57d30 + version: 1dfb68239632ee8c667290e30b31cf294bc3d6ae - name: github.com/btcsuite/go-flags version: 6c288d648c1cc1befcb90cb5511dcacf64ae8e61 - name: github.com/btcsuite/go-socks @@ -51,9 +51,9 @@ imports: - name: github.com/decred/blake256 version: a840e32d7c31fe2e0218607334cb120a683951a4 - name: github.com/decred/dcrrpcclient - version: 298b75929e994406aee5499af2ccabd894c9a4fd + version: 662d2409dd72666076572cb6a2944875b892e9a5 - name: github.com/decred/dcrutil - version: f3e368a4178919ac884566084ece536c791cce52 + version: a5fab53cab39b793142c8453caa4c6f83bc152d4 subpackages: - base58 - bloom