Add weight == 0 condition to giveRightToVote function

This will make it so votes can't be deleted accidentally by giving someone with weight > 1 the right to vote again
This commit is contained in:
Dillon Arevalo 2017-06-20 20:48:49 -07:00
parent cb5f2f90f6
commit 552f2e5303

View File

@ -94,7 +94,7 @@ of votes.
// called incorrectly. But watch out, this // called incorrectly. But watch out, this
// will currently also consume all provided gas // will currently also consume all provided gas
// (this is planned to change in the future). // (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; voters[voter].weight = 1;
} }