diff options
author | nthumann <me@n-thumann.de> | 2020-09-06 18:11:18 +0200 |
---|---|---|
committer | nthumann <me@n-thumann.de> | 2020-09-09 20:57:06 +0200 |
commit | 62dba9628d2532dca0c44934600f5aac3b21e275 (patch) | |
tree | 770e4becb6379289ae569c71822b299462df2265 /src/validation.cpp | |
parent | 68d1f1698f50f9f3c848d988b6f89fe981cc662c (diff) | |
download | bitcoin-62dba9628d2532dca0c44934600f5aac3b21e275.tar.xz |
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.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 58af8744d9..824f4a766b 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2441,9 +2441,9 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C } bilingual_str warning_messages; + int num_unexpected_version = 0; if (!::ChainstateActive().IsInitialBlockDownload()) { - int nUpgraded = 0; const CBlockIndex* pindex = pindexNew; for (int bit = 0; bit < VERSIONBITS_NUM_BITS; bit++) { WarningBitsConditionChecker checker(bit); @@ -2462,11 +2462,9 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C { int32_t nExpectedVersion = ComputeBlockVersion(pindex->pprev, chainParams.GetConsensus()); if (pindex->nVersion > VERSIONBITS_LAST_OLD_BLOCK_VERSION && (pindex->nVersion & ~nExpectedVersion) != 0) - ++nUpgraded; + ++num_unexpected_version; pindex = pindex->pprev; } - if (nUpgraded > 0) - AppendWarning(warning_messages, strprintf(_("%d of last 100 blocks have unexpected version"), nUpgraded)); } 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, @@ -2474,6 +2472,10 @@ 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. |