diff --git a/qa/rpc-tests/test_framework/test_framework.py b/qa/rpc-tests/test_framework/test_framework.py index c8ace8874..8c781df9a 100755 --- a/qa/rpc-tests/test_framework/test_framework.py +++ b/qa/rpc-tests/test_framework/test_framework.py @@ -391,7 +391,7 @@ class DashTestFramework(BitcoinTestFramework): return False return True - def wait_for_quorum_phase(self, phase, check_received_messages, check_received_messages_count, timeout=5): + def wait_for_quorum_phase(self, phase, check_received_messages, check_received_messages_count, timeout=15): t = time() while time() - t < timeout: all_ok = True @@ -404,7 +404,7 @@ class DashTestFramework(BitcoinTestFramework): all_ok = False break if check_received_messages is not None: - if s["receivedContributions"] < check_received_messages_count: + if s[check_received_messages] < check_received_messages_count: all_ok = False break if all_ok: @@ -412,7 +412,7 @@ class DashTestFramework(BitcoinTestFramework): sleep(0.1) raise AssertionError("wait_for_quorum_phase timed out") - def wait_for_quorum_commitment(self, timeout = 5): + def wait_for_quorum_commitment(self, timeout = 15): t = time() while time() - t < timeout: all_ok = True @@ -449,7 +449,7 @@ class DashTestFramework(BitcoinTestFramework): self.nodes[0].generate(2) # Make sure all reached phase 3 (complain) and received all complaints - self.wait_for_quorum_phase(3, "receivedComplaints" if expected_valid_count != 0 else None, expected_valid_count) + self.wait_for_quorum_phase(3, "receivedComplaints" if expected_valid_count != 10 else None, expected_valid_count) set_mocktime(get_mocktime() + 1) set_node_times(self.nodes, get_mocktime()) self.nodes[0].generate(2) diff --git a/src/llmq/quorums_dkgsessionhandler.cpp b/src/llmq/quorums_dkgsessionhandler.cpp index 18e62bb58..859e439fc 100644 --- a/src/llmq/quorums_dkgsessionhandler.cpp +++ b/src/llmq/quorums_dkgsessionhandler.cpp @@ -121,7 +121,7 @@ void CDKGSessionHandler::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBl quorumHash = pindexQuorum->GetBlockHash(); bool fNewPhase = (quorumStageInt % params.dkgPhaseBlocks) == 0; - int phaseInt = quorumStageInt / params.dkgPhaseBlocks; + int phaseInt = quorumStageInt / params.dkgPhaseBlocks + 1; if (fNewPhase && phaseInt >= QuorumPhase_Initialized && phaseInt <= QuorumPhase_Idle) { phase = static_cast(phaseInt); if (phase == QuorumPhase_Initialized) { diff --git a/src/llmq/quorums_dkgsessionhandler.h b/src/llmq/quorums_dkgsessionhandler.h index caa89a2dc..17172780b 100644 --- a/src/llmq/quorums_dkgsessionhandler.h +++ b/src/llmq/quorums_dkgsessionhandler.h @@ -16,7 +16,7 @@ namespace llmq enum QuorumPhase { QuorumPhase_None = -1, - QuorumPhase_Initialized, + QuorumPhase_Initialized = 1, QuorumPhase_Contribute, QuorumPhase_Complain, QuorumPhase_Justify,