don't overwrite values when omitted

This commit is contained in:
Niko Storni 2019-06-12 22:18:03 +02:00
parent 6226c2690d
commit f5de4e96c3
2 changed files with 7 additions and 7 deletions

View file

@ -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) {

View file

@ -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