Add check for whether voter has right to vote

This commit is contained in:
Berk Erol 2018-10-26 09:53:57 +03:00 committed by GitHub
parent 41375b5d79
commit 19064e81bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,6 +152,7 @@ of votes.
/// to proposal `proposals[proposal].name`.
function vote(uint proposal) public {
Voter storage sender = voters[msg.sender];
require(sender.weight != 0, "Has no right to vote");
require(!sender.voted, "Already voted.");
sender.voted = true;
sender.vote = proposal;