Fix LLMQ related test failures on Travis (#2666)

* Use fast_dip3_enforcement instead of fast_dip3_activation

DashTestFramework was refactored before ChainLocks got merged, causing tests
to fail now.

* Move updating of DKG debug status into WaitForNextPhase

Otherwise callers of the RPCs might believe that the next phase has already
started and start producing more blocks, which would then cancel the
current session if it happens faster than the phase handler thread can
progress to the next phase.
This commit is contained in:
Alexander Block 2019-01-30 14:05:22 +01:00 committed by GitHub
parent 6fe479aa12
commit 54f576ea7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View File

@ -17,7 +17,7 @@ Checks LLMQs based ChainLocks
class LLMQChainLocksTest(DashTestFramework):
def __init__(self):
super().__init__(11, 10, [], fast_dip3_activation=True)
super().__init__(11, 10, [], fast_dip3_enforcement=True)
def run_test(self):

View File

@ -123,9 +123,6 @@ void CDKGSessionHandler::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBl
int phaseInt = quorumStageInt / params.dkgPhaseBlocks + 1;
if (fNewPhase && phaseInt >= QuorumPhase_Initialized && phaseInt <= QuorumPhase_Idle) {
phase = static_cast<QuorumPhase>(phaseInt);
if (phase == QuorumPhase_Initialized) {
quorumDKGDebugManager->ResetLocalSessionStatus(params.type, quorumHash, quorumHeight);
}
}
quorumDKGDebugManager->UpdateLocalStatus([&](CDKGDebugStatus& status) {
@ -133,11 +130,6 @@ void CDKGSessionHandler::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBl
status.nHeight = (uint32_t)pindexNew->nHeight;
return changed;
});
quorumDKGDebugManager->UpdateLocalSessionStatus(params.type, [&](CDKGDebugSessionStatus& status) {
bool changed = status.phase != (uint8_t)phase;
status.phase = (uint8_t)phase;
return changed;
});
}
void CDKGSessionHandler::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
@ -199,7 +191,7 @@ void CDKGSessionHandler::WaitForNextPhase(QuorumPhase curPhase,
throw AbortPhaseException();
}
if (p.first == nextPhase) {
return;
break;
}
if (curPhase != QuorumPhase_None && p.first != curPhase) {
throw AbortPhaseException();
@ -208,6 +200,15 @@ void CDKGSessionHandler::WaitForNextPhase(QuorumPhase curPhase,
MilliSleep(100);
}
}
if (nextPhase == QuorumPhase_Initialized) {
quorumDKGDebugManager->ResetLocalSessionStatus(params.type, quorumHash, quorumHeight);
}
quorumDKGDebugManager->UpdateLocalSessionStatus(params.type, [&](CDKGDebugSessionStatus& status) {
bool changed = status.phase != (uint8_t)nextPhase;
status.phase = (uint8_t)nextPhase;
return changed;
});
}
void CDKGSessionHandler::WaitForNewQuorum(const uint256& oldQuorumHash)