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

Setticketsvotebits #39

Merged
merged 4 commits into from
Nov 2, 2016
Merged

Setticketsvotebits #39

merged 4 commits into from
Nov 2, 2016

Conversation

chappjc
Copy link
Member

@chappjc chappjc commented Oct 19, 2016

For the dcrjson addition: decred/dcrd@cc25399
And the dcrwallet addition:
decred/dcrwallet@781468d

Needs EncodeConcatenatedHashed in dcrd PR decred/dcrd#429

@alexlyp
Copy link
Member

alexlyp commented Oct 25, 2016

are you going to resubmit your PR with fixed EncodeConcatenatedHashes ? I can get this is in if it's ready.

@chappjc
Copy link
Member Author

chappjc commented Oct 25, 2016

I'm swamped. Sorry

@alexlyp
Copy link
Member

alexlyp commented Oct 26, 2016

Oh no worries, wasn't trying to nag :)

@chappjc
Copy link
Member Author

chappjc commented Nov 1, 2016

EncodeConcatenatedHashes actually implemented, but this PR is still untested.

@chappjc
Copy link
Member Author

chappjc commented Nov 1, 2016

In dcrrpcclient, GetTicketsVoteBits/GetTicketsVoteBitsAsync was written with a []*chainhash.Hash so the same was done in this PR for SetTicketsVoteBits*. However, EncodeConcatenatedHashes (just merged into dcrd) takes a []chainhash.Hash instead of a []*chainhash.Hash because the output of the existing Decode... was a[]chainhash.Hash. Consistency is achieved within the packages, but dcrjson and dcrrpcclient don't play nice.

Unless I'm missing a trick, the slice of hash pointers input to SetTickets... needs to be converted to a slice of hashes. That's not much burden on dcrrpcclient, but it's an extra step I wanted to point out. The alternative is to let SetTicketsVoteBits* in this PR take a []chainhash.Hash although GetTicketsVoteBits* does not. Thoughts about this?

Also, it's curious that getTicketsVoteBits in dcrwallet/rpc/legacyrpc takes hashes as a []string instead of concatenated into a single string as setTicketsVoteBits does. No decoding necessary there.

// provided by the server.
func (r FutureSetTicketsVoteBitsResult) Receive() error {
_, err := receiveFuture(r)
return err
Copy link
Member Author

@chappjc chappjc Nov 1, 2016

Choose a reason for hiding this comment

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

Any reason to use previous?

if err != nil {
    return err
}

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.

I suppose for readability, but this way is acceptable.

Copy link
Member

@alexlyp alexlyp left a comment

Choose a reason for hiding this comment

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

@jrick has talked to me about trying to make an effort to change to []Hashes instead of []*Hashes when possible. So this would keep in line with the direction we want to go.

OK

// provided by the server.
func (r FutureSetTicketsVoteBitsResult) Receive() error {
_, err := receiveFuture(r)
return err
Copy link
Member

Choose a reason for hiding this comment

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

I suppose for readability, but this way is acceptable.

@alexlyp alexlyp merged commit 6ef6822 into decred:master Nov 2, 2016
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