From 19064e81bc07c75a5b7626fc97315e92ec09db7b Mon Sep 17 00:00:00 2001 From: Berk Erol Date: Fri, 26 Oct 2018 09:53:57 +0300 Subject: [PATCH] Add check for whether voter has right to vote --- docs/solidity-by-example.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst index 8f58f339d..f71f1e23c 100644 --- a/docs/solidity-by-example.rst +++ b/docs/solidity-by-example.rst @@ -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;