Change ifelse branches in CountVotes() - #367
Conversation
- Bumps version to v4.5.1 - Sets a fork height at 2722100 - Requires blocks to signal version bit 21 when fork happens. Merge after navcoin#367 navcoin#369 and navcoin#370 or when its related issues are fixed.
|
@marcus290 what have you tested on this fix? do we need to write or update any unit tests? |
|
im compiling and testing this now |
|
I've compiled and run the tests and they all pass. I also compiled the master branch and ran the tests against that and they pass there too. So I'm unable to say just by the tests that the bug is fixed. I am wondering if when we find a bug like this, the first step should be to write a test that fails when the bug is present but should pass when the bug is fixed. Therefore we can definitively say that the bug is fixed. I am going to see if i can modify the test to reproduce the issue on master and resolve it on the patch branch. |
|
@craigmacgregor there are two issues -
Steps to reproduce the issues:
I manually retested both these issues with this commit and they are fixed according to my tests. Agreed we should write tests. |
- Bumps version to v4.5.1 - Sets a fork height at 2722100 - Requires blocks to signal version bit 21 when fork happens. Merge after navcoin#367 navcoin#369 and navcoin#370 or when its related issues are fixed.
* Change ifelse branches count votes * Change ifelse branches count votes for prequests * a proposal in state expired is always expired * add test
This PR fixes a bug in the logic of the CountVotes() function which can cause a proposal to morph from a Expired state back to an Accepted state when a node reindex the chainstate db and the proposal expired being accepted.
The fix involves changing the structure of some conditionals, so in the case when a proposal state and status do not match the next else if branches are not triggered. It also considers a proposal unexpired state as always expired. See the changes list for more details.
This issue is critical as it can cause two different states in different nodes and a fork in the network.