aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-26 17:42:34 +0800
committerGitHub <noreply@github.com>2018-10-26 17:42:34 +0800
commitc84003533f3e8511481db3d9b0dfc7f2a9d9564e (patch)
tree59dea57f88723cbe14f3d5d2b8737ebb2da3b53f
parent41375b5d79a77d392922f36f149d5bef269303e6 (diff)
parent19064e81bc07c75a5b7626fc97315e92ec09db7b (diff)
downloaddexon-solidity-c84003533f3e8511481db3d9b0dfc7f2a9d9564e.tar.gz
dexon-solidity-c84003533f3e8511481db3d9b0dfc7f2a9d9564e.tar.zst
dexon-solidity-c84003533f3e8511481db3d9b0dfc7f2a9d9564e.zip
Merge pull request #5314 from berkerol/patch-1
DOCS: Add check for whether voter has right to vote
-rw-r--r--docs/solidity-by-example.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index 8f58f339..f71f1e23 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;