refactor: Mark btcsignals operator [[nodiscard]]
What changed, and why it matters
This is a minor code-quality change that tells the compiler to warn when a developer ignores the return value of a specific function call. It does not change how the program behaves, fix a bug, or close a security hole. It is a routine refactoring to help catch future programming mistakes during compilation.
No security action required. Treat as a normal code-quality/refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds the C++17 [[nodiscard]] attribute to the function-call operator of the btcsignals class in src/btcsignals.h. This attribute causes compilers to emit a warning if the caller discards the return value when result_type is non-void. The change is purely compile-time and does not alter runtime behavior, semantics, locking, or the existing API. No vulnerability is addressed.
Changed components
src/btcsignals.hInspect captured patch +1 / −1
diff --git a/src/btcsignals.h b/src/btcsignals.h
index 9eeca769..94625edd 100644
--- a/src/btcsignals.h
+++ b/src/btcsignals.h
@@ -200,7 +200,7 @@ public:
* more than one callback is enabled.
*/
template <typename... Args>
- result_type operator()(Args&&... args) const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
+ [[nodiscard]] result_type operator()(Args&&... args) const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
{
std::vector<std::shared_ptr<connection_holder>> connections;
{
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.