Skip to content

Commit f5de4e9

Browse files
committed
don't overwrite values when omitted
1 parent 6226c26 commit f5de4e9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

extras/jsonrpc/daemon.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ func (d *Client) SingleAccountList(accountID string) (*Account, error) {
149149
}
150150

151151
type AccountSettings struct {
152-
Default bool `json:"default"`
153-
NewName string `json:"new_name"`
154-
ReceivingGap int `json:"receiving_gap"`
155-
ReceivingMaxUses int `json:"receiving_max_uses"`
156-
ChangeGap int `json:"change_gap"`
157-
ChangeMaxUses int `json:"change_max_uses"`
152+
Default *bool `json:"default,omitempty"`
153+
NewName *string `json:"new_name,omitempty"`
154+
ReceivingGap *int `json:"receiving_gap,omitempty"`
155+
ReceivingMaxUses *int `json:"receiving_max_uses,omitempty"`
156+
ChangeGap *int `json:"change_gap,omitempty"`
157+
ChangeMaxUses *int `json:"change_max_uses,omitempty"`
158158
}
159159

160160
func (d *Client) AccountSet(accountID string, settings AccountSettings) (*Account, error) {

extras/jsonrpc/daemon_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ func TestClient_AccountSet(t *testing.T) {
350350
}
351351
account := (accounts.LBCRegtest)[0].ID
352352

353-
got, err := d.AccountSet(account, AccountSettings{ChangeMaxUses: 10000})
353+
got, err := d.AccountSet(account, AccountSettings{ChangeMaxUses: util.PtrToInt(10000)})
354354
if err != nil {
355355
t.Error(err)
356356
return

0 commit comments

Comments
 (0)