fix: fix potential mutex lifetime issue were we are returning a reference, and then releasing the mutex

This commit is contained in:
pasta 2024-03-23 20:04:52 -05:00
parent 85caf8aa34
commit 7f36f122b2
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -663,8 +663,9 @@ void CDKGSession::VerifyAndJustify(CDKGPendingMessages& pendingMessages)
continue;
}
const auto& qc = WITH_LOCK(invCs, return std::move(complaints.at(*m->complaints.begin())));
if (qc.complainForMembers[*myIdx]) {
LOCK(invCs);
if (const auto& qc = complaints.at(*m->complaints.begin());
qc.complainForMembers[*myIdx]) {
justifyFor.emplace(qc.proTxHash);
}
}