Add receivedFinalCommitment flag to CDKGDebugSessionStatus

This commit is contained in:
Alexander Block 2019-01-21 05:45:37 +01:00
parent 23d7ed80d5
commit 0cc1cf2798
3 changed files with 13 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include "quorums_blockprocessor.h"
#include "quorums_commitment.h"
#include "quorums_debug.h"
#include "quorums_utils.h"
#include "evo/specialtx.h"
@ -336,6 +337,14 @@ void CQuorumBlockProcessor::AddMinableCommitment(const CFinalCommitment& fqc)
}
}
quorumDKGDebugManager->UpdateLocalSessionStatus((Consensus::LLMQType)fqc.llmqType, [&](CDKGDebugSessionStatus& status) {
if (status.quorumHash != fqc.quorumHash || status.receivedFinalCommitment) {
return false;
}
status.receivedFinalCommitment = true;
return true;
});
// We only relay the new commitment if it's new or better then the old one
if (relay) {
CInv inv(MSG_QUORUM_FINAL_COMMITMENT, commitmentHash);

View File

@ -95,6 +95,7 @@ UniValue CDKGDebugSessionStatus::ToJson(int detailLevel) const
push(receivedComplaints, "receivedComplaints");
push(receivedJustifications, "receivedJustifications");
push(receivedPrematureCommitments, "receivedPrematureCommitments");
ret.push_back(Pair("receivedFinalCommitment", receivedFinalCommitment));
if (detailLevel == 2) {
UniValue arr(UniValue::VARR);
@ -296,6 +297,7 @@ void CDKGDebugManager::ResetLocalSessionStatus(Consensus::LLMQType llmqType, con
session.statusBitset = 0;
session.members.clear();
session.members.resize((size_t)params.size);
session.receivedFinalCommitment = false;
}
void CDKGDebugManager::UpdateLocalStatus(std::function<bool(CDKGDebugStatus& status)>&& func)

View File

@ -78,6 +78,7 @@ public:
};
std::vector<CDKGDebugMemberStatus> members;
bool receivedFinalCommitment{false};
public:
CDKGDebugSessionStatus() : statusBitset(0) {}
@ -94,6 +95,7 @@ public:
READWRITE(phase);
READWRITE(statusBitset);
READWRITE(members);
READWRITE(receivedFinalCommitment);
}
UniValue ToJson(int detailLevel) const;