mirror of
https://github.com/status-im/community-dapp.git
synced 2025-02-23 11:38:40 +00:00
The `FeaturedVotingContract` comes with a check in `initializeVoting()` that aims to ensure that the community that the voting is being initialized for, has not been featured previously for #n votings. This is denoted as the `cooldownPeriod`. If `cooldownPeriod = 1`, this means there needs to be at least one voting which doesn't include the community in question, that came *after* the voting that did. The internal `_isInCooldownPeriod()` check has a bug which will return false positives for any communiy that has been featured before, regardless of `cooldownPeriod`s value. When iterating previous votings, the contract actually needs to start with the last one and iterate downwards, however it does the opposite so it will never reach the correct votings to check. This commit fixes the check and adds two tests to cover the case accordingly.