Merge bitcoin/bitcoin#30962: validation: Disable CheckForkWarningConditions for background chainstate

c0a0c72b4d68a4f0c53c2c4b95f4d6e399f8e4ee validation: Disable CheckForkWarningConditions for background chainstate (Martin Zumsande)

Pull request description:

  The comparison of `m_best_invalid` with the tip of the chainstate makes no sense for the background chainstate and can lead to incorrect log messages.

  Fixes #30958

ACKs for top commit:
  fjahr:
    utACK c0a0c72b4d68a4f0c53c2c4b95f4d6e399f8e4ee
  achow101:
    ACK c0a0c72b4d68a4f0c53c2c4b95f4d6e399f8e4ee
  TheCharlatan:
    ACK c0a0c72b4d68a4f0c53c2c4b95f4d6e399f8e4ee
  tdb3:
    CR ACK c0a0c72b4d68a4f0c53c2c4b95f4d6e399f8e4ee

Tree-SHA512: 316811b1ade8521681f3a105c7db59dfdb27b1e13efeba95cd6183d750db2e07f48968e8fc54fe3834d3311519cf8c6b77d7e0fd61facbf2b07598e79110ff85
This commit is contained in:
Ava Chow 2024-09-25 14:33:31 -04:00
commit da612cea03
No known key found for this signature in database
GPG Key ID: 17565732E08E5E41

View File

@ -2020,7 +2020,8 @@ void Chainstate::CheckForkWarningConditions()
// Before we get past initial download, we cannot reliably alert about forks
// (we assume we don't get stuck on a fork before finishing our initial sync)
if (m_chainman.IsInitialBlockDownload()) {
// Also not applicable to the background chainstate
if (m_chainman.IsInitialBlockDownload() || this->GetRole() == ChainstateRole::BACKGROUND) {
return;
}