node: update uiInterface whenever warnings updated

This commit introduces slight behaviour change. Previously, the
GUI status bar would be updated for most warnings, namely
UNKNOWN_NEW_RULES_ACTIVATED, CLOCK_OUT_OF_SYNC and
PRE_RELEASE_TEST_BUILD, but not for LARGE_WORK_INVALID_CHAIN
(and not for FATAL_INTERNAL_ERROR, but that is not really
meaningful).

Fix this by always updating the status bar when the warnings are
changed.
This commit is contained in:
stickies-v
2024-05-07 17:22:49 +01:00
parent b071ad9770
commit 9c4b0b7ce4
4 changed files with 10 additions and 9 deletions

View File

@@ -8,6 +8,7 @@
#include <node/warnings.h>
#include <common/system.h>
#include <node/interface_ui.h>
#include <sync.h>
#include <univalue.h>
#include <util/translation.h>
@@ -31,12 +32,15 @@ bool Warnings::Set(warning_type id, bilingual_str message)
{
LOCK(m_mutex);
const auto& [_, inserted]{m_warnings.insert({id, std::move(message)})};
if (inserted) uiInterface.NotifyAlertChanged();
return inserted;
}
bool Warnings::Unset(warning_type id)
{
return WITH_LOCK(m_mutex, return m_warnings.erase(id));
auto success{WITH_LOCK(m_mutex, return m_warnings.erase(id))};
if (success) uiInterface.NotifyAlertChanged();
return success;
}
std::vector<bilingual_str> Warnings::GetMessages() const