Skip to content

Commit

Permalink
Fix cycleEndHeight for emergency VOC (#1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixa84 authored Jan 18, 2023
1 parent 5d77d20 commit 314cf76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/masternodes/proposals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ std::optional<CProposalObject> CProposalView::GetProposal(const CProposalId &pro
if (auto cycle = ReadBy<ByStatus, uint8_t>(key)) {
prop->cycle = *cycle;
prop->status = status;
prop->cycleEndHeight = prop->creationHeight +
prop->cycleEndHeight = prop->options & CProposalOption::Emergency ? prop->proposalEndHeight : prop->creationHeight +
(prop->votingPeriod - prop->creationHeight % prop->votingPeriod) +
prop->votingPeriod * *cycle;
return true;
Expand Down
10 changes: 5 additions & 5 deletions test/functional/feature_on_chain_government.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ def run_test(self):
self.nodes[3].generate(1)
self.sync_blocks()

cycle1 = creationHeight + (emergencyPeriod - creationHeight % emergencyPeriod) + emergencyPeriod
proposalEndHeight = creationHeight + emergencyPeriod
cycle1 = creationHeight + emergencyPeriod
proposalEndHeight = cycle1

# Check results
result = self.nodes[0].getgovproposal(tx)
Expand Down Expand Up @@ -655,9 +655,9 @@ def run_test(self):
self.sync_blocks()

assert_equal(self.nodes[0].listgovproposals({"cycle":1, "pagination": {"start": cfp1, "including_start": True, "limit": 1}})[0]["proposalId"], cfp1)
assert_equal(len(self.nodes[0].listgovproposals({"cycle":5})), 3)
assert_equal(self.nodes[0].listgovproposals({"cycle":5, "pagination": {"start": tx2, "including_start": True, "limit": 1}})[0]["proposalId"], tx2)
assert_equal(self.nodes[0].listgovproposals({"cycle":5, "pagination": {"start": tx3, "including_start": True, "limit": 1}})[0]["proposalId"], tx3)
assert_equal(len(self.nodes[0].listgovproposals({"cycle":6})), 3)
assert_equal(self.nodes[0].listgovproposals({"cycle":6, "pagination": {"start": tx2, "including_start": True, "limit": 1}})[0]["proposalId"], tx2)
assert_equal(self.nodes[0].listgovproposals({"cycle":6, "pagination": {"start": tx3, "including_start": True, "limit": 1}})[0]["proposalId"], tx3)

assert_equal(len(self.nodes[0].listgovproposals({"type": "cfp"})), 5)
assert_equal(self.nodes[0].listgovproposals({"type": "cfp", "pagination": {"start": cfp1, "including_start": True, "limit": 1}})[0]["proposalId"], cfp1)
Expand Down

0 comments on commit 314cf76

Please sign in to comment.