Skip to content

Commit a8ac6ef

Browse files
committed
client: Send empty VoteChoices instead of nil
1 parent 44c8809 commit a8ac6ef

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

client/client.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022-2024 The Decred developers
1+
// Copyright (c) 2022-2025 The Decred developers
22
// Use of this source code is governed by an ISC
33
// license that can be found in the LICENSE file.
44

@@ -66,8 +66,11 @@ func (c *Client) FeeAddress(ctx context.Context, req types.FeeAddressRequest,
6666
func (c *Client) PayFee(ctx context.Context, req types.PayFeeRequest,
6767
commitmentAddr stdaddr.Address) (*types.PayFeeResponse, error) {
6868

69-
// TSpendPolicy and TreasuryPolicy are optional but must be an empty map
70-
// rather than nil.
69+
// VoteChoices, TSpendPolicy and TreasuryPolicy are optional but must be an
70+
// empty map rather than nil.
71+
if req.VoteChoices == nil {
72+
req.VoteChoices = map[string]string{}
73+
}
7174
if req.TSpendPolicy == nil {
7275
req.TSpendPolicy = map[string]string{}
7376
}
@@ -119,8 +122,11 @@ func (c *Client) TicketStatus(ctx context.Context, req types.TicketStatusRequest
119122
func (c *Client) SetVoteChoices(ctx context.Context, req types.SetVoteChoicesRequest,
120123
commitmentAddr stdaddr.Address) (*types.SetVoteChoicesResponse, error) {
121124

122-
// TSpendPolicy and TreasuryPolicy are optional but must be an empty map
123-
// rather than nil.
125+
// VoteChoices, TSpendPolicy and TreasuryPolicy are optional but must be an
126+
// empty map rather than nil.
127+
if req.VoteChoices == nil {
128+
req.VoteChoices = map[string]string{}
129+
}
124130
if req.TSpendPolicy == nil {
125131
req.TSpendPolicy = map[string]string{}
126132
}

0 commit comments

Comments
 (0)