Skip to content

Commit 62dba96

Browse files
committed
log: print unexpected version warning in validation log category
Instead of printing "<n> of the last 100 blocks have unexpected version" as a warning appended to UpdateTip, it is now printed in the validation log category.
1 parent 68d1f16 commit 62dba96

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/validation.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,9 +2441,9 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C
24412441
}
24422442

24432443
bilingual_str warning_messages;
2444+
int num_unexpected_version = 0;
24442445
if (!::ChainstateActive().IsInitialBlockDownload())
24452446
{
2446-
int nUpgraded = 0;
24472447
const CBlockIndex* pindex = pindexNew;
24482448
for (int bit = 0; bit < VERSIONBITS_NUM_BITS; bit++) {
24492449
WarningBitsConditionChecker checker(bit);
@@ -2462,18 +2462,20 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C
24622462
{
24632463
int32_t nExpectedVersion = ComputeBlockVersion(pindex->pprev, chainParams.GetConsensus());
24642464
if (pindex->nVersion > VERSIONBITS_LAST_OLD_BLOCK_VERSION && (pindex->nVersion & ~nExpectedVersion) != 0)
2465-
++nUpgraded;
2465+
++num_unexpected_version;
24662466
pindex = pindex->pprev;
24672467
}
2468-
if (nUpgraded > 0)
2469-
AppendWarning(warning_messages, strprintf(_("%d of last 100 blocks have unexpected version"), nUpgraded));
24702468
}
24712469
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__,
24722470
pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, pindexNew->nVersion,
24732471
log(pindexNew->nChainWork.getdouble())/log(2.0), (unsigned long)pindexNew->nChainTx,
24742472
FormatISO8601DateTime(pindexNew->GetBlockTime()),
24752473
GuessVerificationProgress(chainParams.TxData(), pindexNew), ::ChainstateActive().CoinsTip().DynamicMemoryUsage() * (1.0 / (1<<20)), ::ChainstateActive().CoinsTip().GetCacheSize(),
24762474
!warning_messages.empty() ? strprintf(" warning='%s'", warning_messages.original) : "");
2475+
2476+
if (num_unexpected_version > 0) {
2477+
LogPrint(BCLog::VALIDATION, "%d of last 100 blocks have unexpected version\n", num_unexpected_version);
2478+
}
24772479
}
24782480

24792481
/** Disconnect m_chain's tip.

0 commit comments

Comments
 (0)