0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

Merge #16793: refactor: Avoid locking cs_main in ProcessNewBlockHeaders

3109a1f948 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
This commit is contained in:
MarcoFalke 2019-09-06 13:58:27 +02:00
commit ae3e3bd151
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25

View file

@ -3398,7 +3398,6 @@ bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidatio
}
}
if (NotifyHeaderTip()) {
LOCK(cs_main);
if (::ChainstateActive().IsInitialBlockDownload() && ppindex && *ppindex) {
LogPrintf("Synchronizing blockheaders, height: %d (~%.2f%%)\n", (*ppindex)->nHeight, 100.0/((*ppindex)->nHeight+(GetAdjustedTime() - (*ppindex)->GetBlockTime()) / Params().GetConsensus().nPowTargetSpacing) * (*ppindex)->nHeight);
}