Skip to content

What happens if _voteOption is something other than 0 or 1? #28

@kangarang

Description

@kangarang

https://github.com/ConsenSys/PLCRVoting/blob/master/contracts/PLCRVoting.sol#L174

function revealVote(uint _pollID, uint _voteOption, uint _salt) external {
    // Make sure the reveal period is active
    require(revealPeriodActive(_pollID));
    require(!hasBeenRevealed(msg.sender, _pollID));                        // prevent user from revealing multiple times
    require(keccak256(_voteOption, _salt) == getCommitHash(msg.sender, _pollID)); // compare resultant hash from inputs to original commitHash

    uint numTokens = getNumTokens(msg.sender, _pollID); 

    if (_voteOption == 1) // apply numTokens to appropriate poll choice
        pollMap[_pollID].votesFor += numTokens;
    else
        pollMap[_pollID].votesAgainst += numTokens;
    
    dllMap[msg.sender].remove(_pollID); // remove the node referring to this vote upon reveal

    VoteRevealed(msg.sender, _pollID, numTokens, _voteOption);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions