aboutsummaryrefslogtreecommitdiff
path: root/src/warnings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/warnings.cpp')
-rw-r--r--src/warnings.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/warnings.cpp b/src/warnings.cpp
index cb73c7aea2..d55eecc48d 100644
--- a/src/warnings.cpp
+++ b/src/warnings.cpp
@@ -3,6 +3,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#if defined(HAVE_CONFIG_H)
+#include <config/bitcoin-config.h>
+#endif
+
#include <warnings.h>
#include <common/system.h>
@@ -10,11 +14,13 @@
#include <util/string.h>
#include <util/translation.h>
+#include <optional>
#include <vector>
static GlobalMutex g_warnings_mutex;
static bilingual_str g_misc_warnings GUARDED_BY(g_warnings_mutex);
static bool fLargeWorkInvalidChainFound GUARDED_BY(g_warnings_mutex) = false;
+static std::optional<bilingual_str> g_timeoffset_warning GUARDED_BY(g_warnings_mutex){};
void SetMiscWarning(const bilingual_str& warning)
{
@@ -28,6 +34,11 @@ void SetfLargeWorkInvalidChainFound(bool flag)
fLargeWorkInvalidChainFound = flag;
}
+void SetMedianTimeOffsetWarning(std::optional<bilingual_str> warning)
+{
+ LOCK(g_warnings_mutex);
+ g_timeoffset_warning = warning;
+}
bilingual_str GetWarnings(bool verbose)
{
bilingual_str warnings_concise;
@@ -52,6 +63,10 @@ bilingual_str GetWarnings(bool verbose)
warnings_verbose.emplace_back(warnings_concise);
}
+ if (g_timeoffset_warning) {
+ warnings_verbose.emplace_back(g_timeoffset_warning.value());
+ }
+
if (verbose) {
return Join(warnings_verbose, Untranslated("<hr />"));
}