aboutsummaryrefslogtreecommitdiff
path: root/src/node/kernel_notifications.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/node/kernel_notifications.cpp')
-rw-r--r--src/node/kernel_notifications.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/node/kernel_notifications.cpp b/src/node/kernel_notifications.cpp
index 44828b8adb..9894052a3a 100644
--- a/src/node/kernel_notifications.cpp
+++ b/src/node/kernel_notifications.cpp
@@ -10,15 +10,16 @@
#include <common/args.h>
#include <common/system.h>
#include <kernel/context.h>
+#include <kernel/warning.h>
#include <logging.h>
#include <node/abort.h>
#include <node/interface_ui.h>
+#include <node/warnings.h>
#include <util/check.h>
#include <util/signalinterrupt.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/translation.h>
-#include <warnings.h>
#include <cstdint>
#include <string>
@@ -28,7 +29,6 @@ using util::ReplaceAll;
static void AlertNotify(const std::string& strMessage)
{
- uiInterface.NotifyAlertChanged();
#if HAVE_SYSTEM
std::string strCmd = gArgs.GetArg("-alertnotify", "");
if (strCmd.empty()) return;
@@ -46,16 +46,6 @@ static void AlertNotify(const std::string& strMessage)
#endif
}
-static void DoWarning(const bilingual_str& warning)
-{
- static bool fWarned = false;
- SetMiscWarning(warning);
- if (!fWarned) {
- AlertNotify(warning.original);
- fWarned = true;
- }
-}
-
namespace node {
kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state, CBlockIndex& index)
@@ -80,20 +70,27 @@ void KernelNotifications::progress(const bilingual_str& title, int progress_perc
uiInterface.ShowProgress(title.translated, progress_percent, resume_possible);
}
-void KernelNotifications::warning(const bilingual_str& warning)
+void KernelNotifications::warningSet(kernel::Warning id, const bilingual_str& message)
+{
+ if (m_warnings.Set(id, message)) {
+ AlertNotify(message.original);
+ }
+}
+
+void KernelNotifications::warningUnset(kernel::Warning id)
{
- DoWarning(warning);
+ m_warnings.Unset(id);
}
void KernelNotifications::flushError(const bilingual_str& message)
{
- AbortNode(&m_shutdown, m_exit_status, message);
+ AbortNode(&m_shutdown, m_exit_status, message, &m_warnings);
}
void KernelNotifications::fatalError(const bilingual_str& message)
{
node::AbortNode(m_shutdown_on_fatal_error ? &m_shutdown : nullptr,
- m_exit_status, message);
+ m_exit_status, message, &m_warnings);
}
void ReadNotificationArgs(const ArgsManager& args, KernelNotifications& notifications)