diff --git a/src/Majority.sol b/src/Majority.sol index 71a5515b03f57807ff9c24e03485377e880accab..07fafc28a8f116b0d93a080297a49b104ef54fb9 100644 --- a/src/Majority.sol +++ b/src/Majority.sol @@ -1,7 +1,7 @@ // Robert Martin-Legene <robert@nic.ar> // vim:syntax:filetype=javascript:ai:sm -pragma solidity ^0.4.24; +pragma solidity ^0.5; // This contract is supposed to maintain a list of accounts authorized // to control members of "the club" using a majority (n/1+1). @@ -28,7 +28,9 @@ contract Majority { constructor() public { - voters.push( msg.sender ); + // Don't want anyone to find a way to trigger the constructor again. + if ( voters.length == 0 ) + voters.push( msg.sender ); } // This function is used to know how many voters exist. @@ -55,7 +57,7 @@ contract Majority { // Beware that: // 0 = not found. // 1 = first position in a list (so this is actually the real list position + 1). - function _findAddressInList( address[] haystack, address needle ) private pure returns (uint) + function _findAddressInList( address[] memory haystack, address needle ) private pure returns (uint) { uint i = haystack.length; while ( i-- > 0 )