Skip to content

Commit 942a330

Browse files
committed
fix issue with delegating votes to people who cannot vote. That made it so that if wallet A delegated to wallet B and B had no rights to vote, than B would lose out on its own vote
1 parent b28cd00 commit 942a330

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/examples/voting.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ of votes.
130130
131131
// Since `sender` is a reference, this
132132
// modifies `voters[msg.sender].voted`
133+
Voter storage delegate_ = voters[to];
134+
135+
// Voters cannot delegate to wallets that cannot vote.
136+
require(delegate_.weight >= 1)
133137
sender.voted = true;
134138
sender.delegate = to;
135-
Voter storage delegate_ = voters[to];
136139
if (delegate_.voted) {
137140
// If the delegate already voted,
138141
// directly add to the number of votes

0 commit comments

Comments
 (0)