Skip to content

Commit

Permalink
[Validation] Verify qfc in CDKGSession::FinalizeCommitments
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed Feb 15, 2022
1 parent 76497b7 commit 25fe8d7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/llmq/quorums_dkgsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,11 @@ std::vector<CFinalCommitment> CDKGSession::FinalizeCommitments()

cxxtimer::Timer totalTimer(true);

std::vector<CBLSPublicKey> allkeys;
for (const auto& m : members) {
allkeys.emplace_back(m->dmn->pdmnState->pubKeyOperator.Get());
}

typedef std::vector<bool> Key;
std::map<Key, std::vector<CDKGPrematureCommitment>> commitmentsMap;

Expand Down Expand Up @@ -1264,13 +1269,21 @@ std::vector<CFinalCommitment> CDKGSession::FinalizeCommitments()
}
t2.stop();

cxxtimer::Timer t3(true);
if (!fqc.Verify(allkeys, params)) {
logger.Batch("failed to verify final commitment");
continue;
}
t3.stop();

finalCommitments.emplace_back(fqc);

logger.Batch("final commitment: validMembers=%d, signers=%d, quorumPublicKey=%s, time1=%d, time2=%d",
logger.Batch("final commitment: validMembers=%d, signers=%d, quorumPublicKey=%s, time1=%d, time2=%d, time3=%d, total=%d",
fqc.CountValidMembers(), fqc.CountSigners(), fqc.quorumPublicKey.ToString(),
t1.count(), t2.count());
t1.count(), t2.count(), t3.count(), totalTimer.count());
}

totalTimer.stop();
logger.Flush();

return finalCommitments;
Expand Down

0 comments on commit 25fe8d7

Please sign in to comment.