aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-21 23:54:55 +0800
committerGitHub <noreply@github.com>2017-06-21 23:54:55 +0800
commitac977cdffa8ff8fa6b89c76cee7c914b806bd9ac (patch)
tree1d05d78f3246580cc53b037d67ce032cc81e0dae
parentcb5f2f90f6d70f299bd0a4e0e6ed597fd728180b (diff)
parent552f2e5303f89b78491a6f267ce54badbdfc8f2e (diff)
downloaddexon-solidity-ac977cdffa8ff8fa6b89c76cee7c914b806bd9ac.tar.gz
dexon-solidity-ac977cdffa8ff8fa6b89c76cee7c914b806bd9ac.tar.zst
dexon-solidity-ac977cdffa8ff8fa6b89c76cee7c914b806bd9ac.zip
Merge pull request #2429 from DillonBArevalo/fix-voting
Add weight == 0 condition to giveRightToVote function
-rw-r--r--docs/solidity-by-example.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index 993e2c18..450b0286 100644
--- a/docs/solidity-by-example.rst
+++ b/docs/solidity-by-example.rst
@@ -94,7 +94,7 @@ of votes.
// called incorrectly. But watch out, this
// will currently also consume all provided gas
// (this is planned to change in the future).
- require((msg.sender == chairperson) && !voters[voter].voted);
+ require((msg.sender == chairperson) && !voters[voter].voted && (voters[voter].weight == 0));
voters[voter].weight = 1;
}
@@ -165,7 +165,7 @@ of votes.
}
}
}
-
+
// Calls winningProposal() function to get the index
// of the winner contained in the proposals array and then
// returns the name of the winner
@@ -273,7 +273,7 @@ activate themselves.
// If the bid is not higher, send the
// money back.
require(msg.value > highestBid);
-
+
if (highestBidder != 0) {
// Sending back the money by simply using
// highestBidder.send(highestBid) is a security risk
@@ -296,7 +296,7 @@ activate themselves.
// before `send` returns.
pendingReturns[msg.sender] = 0;
- if (!msg.sender.send(amount)) {
+ if (!msg.sender.send(amount)) {
// No need to call throw here, just reset the amount owing
pendingReturns[msg.sender] = amount;
return false;