Skip to content

Commit 7a5be4a

Browse files
authored
Merge pull request #12462 from semaraugusto/develop
[docs] fix issue with delegating votes to wallets who cannot vote.
2 parents b3ccc01 + 6fbfa33 commit 7a5be4a

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)