introduce and use the generalized node::Warnings interface

Instead of having separate warning functions (and globals) for each
different warning that can be raised, encapsulate this logic into
a single class and allow to (un)set any number of warnings.

Introduces behaviour change:
- the `-alertnotify` command is executed for all
  `KernelNotifications::warningSet` calls, which now also covers the
  `LARGE_WORK_INVALID_CHAIN` warning.
- previously, warnings were returned based on a predetermined order,
  e.g. with the "pre-release test build" warning always first. This
  is no longer the case, and Warnings::GetMessages() will return
  messages sorted by the id of the warning.

Removes warnings.cpp from kernel.
This commit is contained in:
stickies-v
2024-05-07 17:05:40 +01:00
parent 20e616f864
commit b071ad9770
15 changed files with 215 additions and 83 deletions

View File

@@ -15,6 +15,10 @@ class CBlockIndex;
enum class SynchronizationState;
struct bilingual_str;
namespace kernel {
enum class Warning;
} // namespace kernel
namespace util {
class SignalInterrupt;
} // namespace util
@@ -34,7 +38,9 @@ public:
void progress(const bilingual_str& title, int progress_percent, bool resume_possible) override;
void warning(const bilingual_str& warning) override;
void warningSet(kernel::Warning id, const bilingual_str& message) override;
void warningUnset(kernel::Warning id) override;
void flushError(const bilingual_str& message) override;