Skip to content

Commit ae3e3bd

Browse files
author
MarcoFalke
committed
Merge #16793: refactor: Avoid locking cs_main in ProcessNewBlockHeaders
3109a1f refactor: Avoid locking cs_main in ProcessNewBlockHeaders (João Barbosa) Pull request description: Builds on #16774, this change avoids locking `cs_main` in `ProcessNewBlockHeaders` when the tip has changed - in this case the removed lock was necessary to just log a message. Top commit has no ACKs. Tree-SHA512: 31be6d319fa122804f72fa813cec5ed041dd7e4aef3c1921124a1f03016925c43cd4d9a272d80093e77fa7600e3506ef47b7bb821afcbffe01e6be9bceb6dc00
2 parents 5e20238 + 3109a1f commit ae3e3bd

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/validation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3398,7 +3398,6 @@ bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidatio
33983398
}
33993399
}
34003400
if (NotifyHeaderTip()) {
3401-
LOCK(cs_main);
34023401
if (::ChainstateActive().IsInitialBlockDownload() && ppindex && *ppindex) {
34033402
LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", (*ppindex)->nHeight, 100.0/((*ppindex)->nHeight+(GetAdjustedTime() - (*ppindex)->GetBlockTime()) / Params().GetConsensus().nPowTargetSpacing) * (*ppindex)->nHeight);
34043403
}

0 commit comments

Comments
 (0)