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

stake: Static assert of vote commitment. #1020

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Feb 2, 2018

This modifies the SSGenBlockVotedOn function to directly copy the hash the vote commits to into a statically sized array versus calling the hash function and thus can remove the potential runtime error.

This is preferred because the code will fail to compile if the size of chainhash.HashSize is every changed which is desirable because it would mean the assumptions the code makes would be invalidated.

It also updates all callers in the repository accordingly.

@davecgh davecgh force-pushed the stake_static_vote_commitment_extraction branch from 85fba16 to 1640b16 Compare February 2, 2018 20:09
This modifies the SSGenBlockVotedOn function to directly copy the hash
the vote commits to into a statically sized array versus calling the
hash function and thus can remove the potential runtime error.

This is preferred because the code will fail to compile if the size
of chainhash.HashSize is every changed which is desirable because it
would mean the assumptions the code makes would be invalidated.

It also updates all callers in the repository accordingly.
@davecgh davecgh force-pushed the stake_static_vote_commitment_extraction branch from 1640b16 to d357113 Compare February 2, 2018 20:20
@davecgh davecgh merged commit d357113 into decred:master Feb 2, 2018
@davecgh davecgh deleted the stake_static_vote_commitment_extraction branch February 2, 2018 20:34
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.

3 participants