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

rpc: Add SetVspdVoteChoice request #1981

Merged
merged 9 commits into from
Feb 18, 2021
Merged

Conversation

alexlyp
Copy link
Member

@alexlyp alexlyp commented Feb 4, 2021

This command connects with the provided VSP host/pubkey and updates any ticket voting choice that VSP may control for the wallet.

Comment on lines 641 to 647
if len(ticketTx.TxOut) != 3 {
return fmt.Errorf("ticket %v has multiple commitments: %w", ticketHash, errNotSolo)
}

if !stake.IsSStx(ticketTx) {
return fmt.Errorf("%v is not a ticket", ticketHash)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's reverse these two checks, so if it does not have 3 outputs and is not a ticket, we don't report it as one.

@@ -241,3 +241,38 @@ func (c *Client) ProcessWithPolicy(ctx context.Context, ticketHash *chainhash.Ha
}
return fp.submitPayment()
}

// SetVoteChoice takes all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to finish comment

Comment on lines 247 to 253
c.mu.Lock()
_, ok := c.jobs[*hash]
c.mu.Unlock()
if ok {
// Already processing this ticket with the VSP.
return nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will prevent us from setting vote choices for any ticket being processed. I believe you meant to test for !ok.

@@ -630,6 +630,66 @@ func (c *Client) status(ctx context.Context, ticketHash *chainhash.Hash) (*ticke
return &resp, nil
}

func (c *Client) setVoteStatus(ctx context.Context, ticketHash *chainhash.Hash, choices []wallet.AgendaChoice) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setVoteChoices perhaps.

@jrick jrick merged commit 1f2b4f5 into decred:master Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants