Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi: Send empty VSP policy fields #2438

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions internal/rpc/jsonrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -4687,6 +4687,18 @@ func (s *Server) setVoteChoice(ctx context.Context, icmd any) (any, error) {
func (s *Server) updateVSPVoteChoices(ctx context.Context, w *wallet.Wallet, ticketHash *chainhash.Hash,
choices map[string]string, tspendPolicy map[string]string, treasuryPolicy map[string]string) error {

// Ensure empty (as opposed to nil) choices on every category (required
// by the contract of the VSP API).
if choices == nil {
choices = map[string]string{}
}
if tspendPolicy == nil {
tspendPolicy = map[string]string{}
}
if treasuryPolicy == nil {
treasuryPolicy = map[string]string{}
}

if ticketHash != nil {
vspHost, err := w.VSPHostForTicket(ctx, ticketHash)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func (w *Wallet) AgendaChoices(ctx context.Context, ticketHash *chainhash.Hash)
const op errors.Op = "wallet.AgendaChoices"
version, deployments := CurrentAgendas(w.chainParams)
if len(deployments) == 0 {
return nil, 0, nil
return map[string]string{}, 0, nil
}

choices = make(map[string]string, len(deployments))
Expand Down
Loading