Skip to content

Commit 848d665

Browse files
committed
Merge #20054: Remove confusing and useless "unexpected version" warning
0000a0c 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 0000a0c decryp2kanon: ACK 0000a0c LarryRuane: ACK 0000a0c Tree-SHA512: 16e069c84be6ab6034baeefdc515d0e5cdf560b2005d2faec5f989d45494bd16cfcb4ffca6a17211d9556ae44f9737a60a476c08b5c2bb5e1bd29724ecd6d5c1
2 parents 884bde5 + 0000a0c commit 848d665

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/validation.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2398,9 +2398,7 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C
23982398
}
23992399

24002400
bilingual_str warning_messages;
2401-
int num_unexpected_version = 0;
2402-
if (!::ChainstateActive().IsInitialBlockDownload())
2403-
{
2401+
if (!::ChainstateActive().IsInitialBlockDownload()) {
24042402
const CBlockIndex* pindex = pindexNew;
24052403
for (int bit = 0; bit < VERSIONBITS_NUM_BITS; bit++) {
24062404
WarningBitsConditionChecker checker(bit);
@@ -2414,25 +2412,13 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C
24142412
}
24152413
}
24162414
}
2417-
// Check the version of the last 100 blocks to see if we need to upgrade:
2418-
for (int i = 0; i < 100 && pindex != nullptr; i++)
2419-
{
2420-
int32_t nExpectedVersion = ComputeBlockVersion(pindex->pprev, chainParams.GetConsensus());
2421-
if (pindex->nVersion > VERSIONBITS_LAST_OLD_BLOCK_VERSION && (pindex->nVersion & ~nExpectedVersion) != 0)
2422-
++num_unexpected_version;
2423-
pindex = pindex->pprev;
2424-
}
24252415
}
24262416
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__,
24272417
pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, pindexNew->nVersion,
24282418
log(pindexNew->nChainWork.getdouble())/log(2.0), (unsigned long)pindexNew->nChainTx,
24292419
FormatISO8601DateTime(pindexNew->GetBlockTime()),
24302420
GuessVerificationProgress(chainParams.TxData(), pindexNew), ::ChainstateActive().CoinsTip().DynamicMemoryUsage() * (1.0 / (1<<20)), ::ChainstateActive().CoinsTip().GetCacheSize(),
24312421
!warning_messages.empty() ? strprintf(" warning='%s'", warning_messages.original) : "");
2432-
2433-
if (num_unexpected_version > 0) {
2434-
LogPrint(BCLog::VALIDATION, "%d of last 100 blocks have unexpected version\n", num_unexpected_version);
2435-
}
24362422
}
24372423

24382424
/** Disconnect m_chain's tip.

0 commit comments

Comments
 (0)