aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 6db723d22c..cf9bfe0e2b 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -27,14 +27,15 @@
#include <kernel/mempool_entry.h>
#include <kernel/messagestartchars.h>
#include <kernel/notifications_interface.h>
+#include <kernel/warning.h>
#include <logging.h>
#include <logging/timer.h>
#include <node/blockstorage.h>
#include <node/utxo_snapshot.h>
-#include <policy/v3_policy.h>
#include <policy/policy.h>
#include <policy/rbf.h>
#include <policy/settings.h>
+#include <policy/v3_policy.h>
#include <pow.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
@@ -57,11 +58,11 @@
#include <util/result.h>
#include <util/signalinterrupt.h>
#include <util/strencodings.h>
+#include <util/string.h>
#include <util/time.h>
#include <util/trace.h>
#include <util/translation.h>
#include <validationinterface.h>
-#include <warnings.h>
#include <algorithm>
#include <cassert>
@@ -1921,9 +1922,11 @@ void Chainstate::CheckForkWarningConditions()
if (m_chainman.m_best_invalid && m_chainman.m_best_invalid->nChainWork > m_chain.Tip()->nChainWork + (GetBlockProof(*m_chain.Tip()) * 6)) {
LogPrintf("%s: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n", __func__);
- SetfLargeWorkInvalidChainFound(true);
+ m_chainman.GetNotifications().warningSet(
+ kernel::Warning::LARGE_WORK_INVALID_CHAIN,
+ _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."));
} else {
- SetfLargeWorkInvalidChainFound(false);
+ m_chainman.GetNotifications().warningUnset(kernel::Warning::LARGE_WORK_INVALID_CHAIN);
}
}
@@ -2847,13 +2850,6 @@ void Chainstate::PruneAndFlush()
}
}
-/** Private helper function that concatenates warning messages. */
-static void AppendWarning(bilingual_str& res, const bilingual_str& warn)
-{
- if (!res.empty()) res += Untranslated(", ");
- res += warn;
-}
-
static void UpdateTipLog(
const CCoinsViewCache& coins_tip,
const CBlockIndex* tip,
@@ -2904,7 +2900,7 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
g_best_block_cv.notify_all();
}
- bilingual_str warning_messages;
+ std::vector<bilingual_str> warning_messages;
if (!m_chainman.IsInitialBlockDownload()) {
const CBlockIndex* pindex = pindexNew;
for (int bit = 0; bit < VERSIONBITS_NUM_BITS; bit++) {
@@ -2913,14 +2909,15 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
if (state == ThresholdState::ACTIVE || state == ThresholdState::LOCKED_IN) {
const bilingual_str warning = strprintf(_("Unknown new rules activated (versionbit %i)"), bit);
if (state == ThresholdState::ACTIVE) {
- m_chainman.GetNotifications().warning(warning);
+ m_chainman.GetNotifications().warningSet(kernel::Warning::UNKNOWN_NEW_RULES_ACTIVATED, warning);
} else {
- AppendWarning(warning_messages, warning);
+ warning_messages.push_back(warning);
}
}
}
}
- UpdateTipLog(coins_tip, pindexNew, params, __func__, "", warning_messages.original);
+ UpdateTipLog(coins_tip, pindexNew, params, __func__, "",
+ util::Join(warning_messages, Untranslated(", ")).original);
}
/** Disconnect m_chain's tip.