Skip to content

Commit

Permalink
Update quorums_chainlocks.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
jagdeep sidhu committed Oct 7, 2022
1 parent 2c622b1 commit 603f67d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/llmq/quorums_chainlocks.cpp
Expand Up @@ -360,7 +360,11 @@ void CChainLocksHandler::ProcessNewChainLock(const NodeId from, llmq::CChainLock
return;
}
CBlockIndex* pindexScan{nullptr};
const CBlockIndex* bestIndex = bestChainLockBlockIndex;
const CBlockIndex* bestIndex;
{
LOCK(cs);
bestIndex = bestChainLockBlockIndex;
}
{
LOCK(cs_main);
if (clsig.nHeight > chainman.ActiveHeight() + (CSigningManager::SIGN_HEIGHT_OFFSET - CSigningManager::SIGN_HEIGHT_LOOKBACK)) {
Expand Down Expand Up @@ -656,7 +660,11 @@ void CChainLocksHandler::TrySignChainTip()
// To simplify the initial implementation, we skip this process and directly try to create a CLSIG
// This will fail when multiple blocks compete, but we accept this for the initial implementation.
// Later, we'll add the multiple attempts process.
const CBlockIndex* bestIndex = bestChainLockBlockIndex;
const CBlockIndex* bestIndex;
{
LOCK(cs);
bestIndex = bestChainLockBlockIndex;
}
{
LOCK(cs_main);
// current chainlock should be confirmed before trying to make new one (don't let headers-only be locked by more than 1 CL)
Expand Down

0 comments on commit 603f67d

Please sign in to comment.