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

0000a0c7e9 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 0000a0c7e9
  decryp2kanon:
    ACK 0000a0c
  LarryRuane:
    ACK 0000a0c7e9

Tree-SHA512: 16e069c84be6ab6034baeefdc515d0e5cdf560b2005d2faec5f989d45494bd16cfcb4ffca6a17211d9556ae44f9737a60a476c08b5c2bb5e1bd29724ecd6d5c1
This commit is contained in:
Wladimir J. van der Laan 2020-11-19 16:39:27 +01:00
commit 848d66519c
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

View File

@ -2398,9 +2398,7 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C
}
bilingual_str warning_messages;
int num_unexpected_version = 0;
if (!::ChainstateActive().IsInitialBlockDownload())
{
if (!::ChainstateActive().IsInitialBlockDownload()) {
const CBlockIndex* pindex = pindexNew;
for (int bit = 0; bit < VERSIONBITS_NUM_BITS; bit++) {
WarningBitsConditionChecker checker(bit);
@ -2414,14 +2412,6 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C
}
}
}
// 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, chainParams.GetConsensus());
if (pindex->nVersion > VERSIONBITS_LAST_OLD_BLOCK_VERSION && (pindex->nVersion & ~nExpectedVersion) != 0)
++num_unexpected_version;
pindex = pindex->pprev;
}
}
LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%f tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo)%s\n", __func__,
pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, pindexNew->nVersion,
@ -2429,10 +2419,6 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C
FormatISO8601DateTime(pindexNew->GetBlockTime()),
GuessVerificationProgress(chainParams.TxData(), pindexNew), ::ChainstateActive().CoinsTip().DynamicMemoryUsage() * (1.0 / (1<<20)), ::ChainstateActive().CoinsTip().GetCacheSize(),
!warning_messages.empty() ? strprintf(" warning='%s'", warning_messages.original) : "");
if (num_unexpected_version > 0) {
LogPrint(BCLog::VALIDATION, "%d of last 100 blocks have unexpected version\n", num_unexpected_version);
}
}
/** Disconnect m_chain's tip.