New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encapsulate warnings in generalized node::Warnings and remove globals #30058
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
cd8b420
to
4f06da2
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
Concept ACK on removing the warnings globals. |
Since rpc/util.cpp is in common, also move GetNodeWarnings() to node::GetWarningsForRPc()
4f06da2
to
3b2b72f
Compare
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 a any number of warnings based on a (non-enforced) unique id string. Introduces behaviour change: the `-alertnotify` command is executed for all `KernelNotifications::warningSet` calls, which now also covers the `large-work-invalid-chain` warning Removes warnings.cpp from kernel
3b2b72f
to
445e6de
Compare
Force-pushed to address compilation failure on non-macOS systems:
|
This PR:
Warnings::Set()
andWarnings::Unset()
methods, instead of having a separate function and globals for each warning. As a result, this simplifies thekernel::Notifications
interface.Behaviour change introduced:
-alertnotify
command is executed for allKernelNotifications::warningSet
calls, which now also covers thelarge-work-invalid-chain
warningnode::AbortNode()
is called, or for thelarge-work-invalid-chain
warningSome discussion points:
const std::string& id
the best way to refer to warnings? Enums are an obvious alternative, but since we need to define warnings across libraries, strings seem like a straightforward solution.