mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
parent
e364909e06
commit
b5c17d7058
@ -106,6 +106,10 @@ of votes.
|
|||||||
if (sender.voted)
|
if (sender.voted)
|
||||||
throw;
|
throw;
|
||||||
|
|
||||||
|
// Self-delegation is not allowed.
|
||||||
|
if (to == msg.sender)
|
||||||
|
throw;
|
||||||
|
|
||||||
// Forward the delegation as long as
|
// Forward the delegation as long as
|
||||||
// `to` also delegated.
|
// `to` also delegated.
|
||||||
// In general, such loops are very dangerous,
|
// In general, such loops are very dangerous,
|
||||||
@ -114,15 +118,11 @@ of votes.
|
|||||||
// In this case, the delegation will not be executed,
|
// In this case, the delegation will not be executed,
|
||||||
// but in other situations, such loops might
|
// but in other situations, such loops might
|
||||||
// cause a contract to get "stuck" completely.
|
// cause a contract to get "stuck" completely.
|
||||||
while (
|
while (voters[to].delegate != address(0)) {
|
||||||
voters[to].delegate != address(0) &&
|
|
||||||
voters[to].delegate != msg.sender
|
|
||||||
) {
|
|
||||||
to = voters[to].delegate;
|
to = voters[to].delegate;
|
||||||
}
|
|
||||||
|
|
||||||
// We found a loop in the delegation, not allowed.
|
// We found a loop in the delegation, not allowed.
|
||||||
if (to == msg.sender) {
|
if (to == msg.sender)
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user