From f5de4e96c37bb786584e5b64c115e279edfa9c1b Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Wed, 12 Jun 2019 22:18:03 +0200 Subject: [PATCH] don't overwrite values when omitted --- extras/jsonrpc/daemon.go | 12 ++++++------ extras/jsonrpc/daemon_test.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/extras/jsonrpc/daemon.go b/extras/jsonrpc/daemon.go index 25fd807..815c87f 100644 --- a/extras/jsonrpc/daemon.go +++ b/extras/jsonrpc/daemon.go @@ -149,12 +149,12 @@ func (d *Client) SingleAccountList(accountID string) (*Account, error) { } type AccountSettings struct { - Default bool `json:"default"` - NewName string `json:"new_name"` - ReceivingGap int `json:"receiving_gap"` - ReceivingMaxUses int `json:"receiving_max_uses"` - ChangeGap int `json:"change_gap"` - ChangeMaxUses int `json:"change_max_uses"` + Default *bool `json:"default,omitempty"` + NewName *string `json:"new_name,omitempty"` + ReceivingGap *int `json:"receiving_gap,omitempty"` + ReceivingMaxUses *int `json:"receiving_max_uses,omitempty"` + ChangeGap *int `json:"change_gap,omitempty"` + ChangeMaxUses *int `json:"change_max_uses,omitempty"` } func (d *Client) AccountSet(accountID string, settings AccountSettings) (*Account, error) { diff --git a/extras/jsonrpc/daemon_test.go b/extras/jsonrpc/daemon_test.go index cc12c48..b072925 100644 --- a/extras/jsonrpc/daemon_test.go +++ b/extras/jsonrpc/daemon_test.go @@ -350,7 +350,7 @@ func TestClient_AccountSet(t *testing.T) { } account := (accounts.LBCRegtest)[0].ID - got, err := d.AccountSet(account, AccountSettings{ChangeMaxUses: 10000}) + got, err := d.AccountSet(account, AccountSettings{ChangeMaxUses: util.PtrToInt(10000)}) if err != nil { t.Error(err) return