Merge pull request #12462 from semaraugusto/develop

[docs] fix issue with delegating votes to wallets who cannot vote.
This commit is contained in:
chriseth 2022-02-15 09:27:33 +01:00 committed by GitHub
commit 7a5be4a063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,9 +130,12 @@ of votes.
// Since `sender` is a reference, this
// modifies `voters[msg.sender].voted`
Voter storage delegate_ = voters[to];
// Voters cannot delegate to wallets that cannot vote.
require(delegate_.weight >= 1);
sender.voted = true;
sender.delegate = to;
Voter storage delegate_ = voters[to];
if (delegate_.voted) {
// If the delegate already voted,
// directly add to the number of votes