Skip to content

Commit

Permalink
Skip starting of cache populator thread in case we don't have a valid…
Browse files Browse the repository at this point in the history
… vvec
  • Loading branch information
codablock committed Jan 16, 2019
1 parent 679a989 commit 217f394
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/llmq/quorums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,24 @@ bool CQuorumManager::BuildQuorumFromCommitment(const CFinalCommitment& qc, std::

quorum->Init(qc.quorumHash, quorumIndex->nHeight, members, qc.validMembers, qc.quorumPublicKey);

if (!quorum->ReadContributions(evoDb)) {
bool hasValidVvec = false;
if (quorum->ReadContributions(evoDb)) {
hasValidVvec = true;
} else {
if (BuildQuorumContributions(qc, quorum)) {
quorum->WriteContributions(evoDb);
hasValidVvec = true;
} else {
LogPrintf("CQuorumManager::%s -- quorum.ReadContributions and BuildQuorumContributions for block %s failed", __func__, qc.quorumHash.ToString());
}
}

// pre-populate caches in the background
// recovering public key shares is quite expensive and would result in serious lags for the first few signing
// sessions if the shares would be calculated on-demand
CQuorum::StartCachePopulatorThread(quorum);
if (hasValidVvec) {
// pre-populate caches in the background
// recovering public key shares is quite expensive and would result in serious lags for the first few signing
// sessions if the shares would be calculated on-demand
CQuorum::StartCachePopulatorThread(quorum);
}

return true;
}
Expand Down

0 comments on commit 217f394

Please sign in to comment.