Merge #20054: Remove confusing and useless "unexpected version" warning

0000a0c7e9e4e7c1afafe6ef75b7624f4c573190 Remove confusing and almost useless "unexpected version" warning (MarcoFalke)

Pull request description:

  It is useless because it isn't displayed for most users:

  * It isn't displayed in normal operation (because the validation debug category is disabled by default)
  * It isn't displayed for users that sync up their nodes intermittently, e.g. once a day or once a week (because it is disabled for IBD)
  * It is only displayed in the debug log (as opposed to the versionbits warning, which is displayed more prominently)

  It is confusing because it doesn't have a use case:

  Despite the above, if a user *did* see the warning, it would most likely be a false positive (like it has been in the past). Even if it wasn't, there is nothing they can do about it. The only thing they could do is to check for updates and hope that a fixed version is available. But why would the user be so scrupulously precise in enabling the warning and reading the log, but then fail to regularly check update channels for updated software?

ACKs for top commit:
  practicalswift:
    ACK 0000a0c7e9e4e7c1afafe6ef75b7624f4c573190
  decryp2kanon:
    ACK 0000a0c
  LarryRuane:
    ACK 0000a0c7e9e4e7c1afafe6ef75b7624f4c573190

Tree-SHA512: 16e069c84be6ab6034baeefdc515d0e5cdf560b2005d2faec5f989d45494bd16cfcb4ffca6a17211d9556ae44f9737a60a476c08b5c2bb5e1bd29724ecd6d5c1
This commit is contained in:
Wladimir J. van der Laan 2020-11-19 16:39:27 +01:00 committed by PastaPastaPasta
parent 37fdef8278
commit 22122ba543

View File

@ -2717,7 +2717,6 @@ void CChainState::UpdateTip(const CBlockIndex* pindexNew)
assert(std::addressof(::ChainstateActive()) == std::addressof(*this));
if (!this->IsInitialBlockDownload())
{
int nUpgraded = 0;
const CBlockIndex* pindex = pindexNew;
for (int bit = 0; bit < VERSIONBITS_NUM_BITS; bit++) {
WarningBitsConditionChecker checker(bit);
@ -2731,16 +2730,6 @@ void CChainState::UpdateTip(const CBlockIndex* pindexNew)
}
}
}
// Check the version of the last 100 blocks to see if we need to upgrade:
for (int i = 0; i < 100 && pindex != nullptr; i++)
{
int32_t nExpectedVersion = ComputeBlockVersion(pindex->pprev, m_params.GetConsensus());
if (pindex->nVersion > VERSIONBITS_LAST_OLD_BLOCK_VERSION && (pindex->nVersion & ~nExpectedVersion) != 0)
++nUpgraded;
pindex = pindex->pprev;
}
if (nUpgraded > 0)
AppendWarning(warningMessages, strprintf(_("%d of last 100 blocks have unexpected version").translated, nUpgraded));
}
assert(std::addressof(::ChainstateActive()) == std::addressof(*this));
LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8g tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo) evodb_cache=%.1fMiB%s\n", __func__,