Skip to content

Commit

Permalink
[validation] Do not actively wait for cs_main lock in `ActivateBestCh…
Browse files Browse the repository at this point in the history
…ain()`
  • Loading branch information
furszy committed Apr 1, 2021
1 parent e2085e5 commit e560afd
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,12 +2241,8 @@ bool ActivateBestChain(CValidationState& state, std::shared_ptr<const CBlock> pb

const CBlockIndex *pindexFork;
bool fInitialDownload;
while (true) {
TRY_LOCK(cs_main, lockMain);
if (!lockMain) {
MilliSleep(50);
continue;
}
{
LOCK(cs_main);
ConnectTrace connectTrace(mempool); // Destructed before cs_main is unlocked

CBlockIndex *pindexOldTip = chainActive.Tip();
Expand All @@ -2268,8 +2264,6 @@ bool ActivateBestChain(CValidationState& state, std::shared_ptr<const CBlock> pb
assert(trace.pblock && trace.pindex);
GetMainSignals().BlockConnected(trace.pblock, trace.pindex, trace.conflictedTxs);
}

break;
}

// Notify external listeners about the new tip.
Expand Down

0 comments on commit e560afd

Please sign in to comment.