signals: use forwarding header for boost signals
What changed, and why it matters
This commit is a simple code cleanup: it creates a new internal header file called btcsignals.h that currently just forwards to Boost's signals library, and then replaces direct Boost signals includes across several source files with this new header. There is no functional change, no bug fix, and no security-relevant behavior change.
No security action needed. This is a benign refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change introduces src/btcsignals.h as a forwarding header wrapping boost/signals2/connection.hpp, boost/signals2/optional_last_value.hpp, and boost/signals2/signal.hpp. It then updates nine files to include btcsignals.h instead of including those Boost headers directly. The commit message explicitly states this is preparatory work for a future replacement of the implementation. No logic, API, or build behavior is altered.
Changed components
src/btcsignals.hsrc/common/interfaces.cppsrc/init.cppsrc/node/interface_ui.cppsrc/node/interfaces.cppsrc/noui.cppsrc/qt/bitcoin.cppsrc/wallet/scriptpubkeyman.hsrc/wallet/wallet.hInspect captured patch +20 / −16
diff --git a/src/btcsignals.h b/src/btcsignals.h
new file mode 100644
index 00000000..816d9125
--- /dev/null
+++ b/src/btcsignals.h
@@ -0,0 +1,12 @@
+// Copyright (c) The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef BITCOIN_BTCSIGNALS_H
+#define BITCOIN_BTCSIGNALS_H
+
+#include <boost/signals2/connection.hpp>
+#include <boost/signals2/optional_last_value.hpp>
+#include <boost/signals2/signal.hpp>
+
+#endif // BITCOIN_BTCSIGNALS_H
diff --git a/src/common/interfaces.cpp b/src/common/interfaces.cpp
index ffd85e61..dc98fac6 100644
--- a/src/common/interfaces.cpp
+++ b/src/common/interfaces.cpp
@@ -2,10 +2,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <btcsignals.h>
#include <interfaces/echo.h>
#include <interfaces/handler.h>
-#include <boost/signals2/connection.hpp>
#include <memory>
#include <utility>
diff --git a/src/init.cpp b/src/init.cpp
index 841fdec5..8e29f70b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -12,6 +12,7 @@
#include <addrman.h>
#include <banman.h>
#include <blockfilter.h>
+#include <btcsignals.h>
#include <chain.h>
#include <chainparams.h>
#include <chainparamsbase.h>
@@ -110,8 +111,6 @@
#include <sys/stat.h>
#endif
-#include <boost/signals2/signal.hpp>
-
#ifdef ENABLE_ZMQ
#include <zmq/zmqabstractnotifier.h>
#include <zmq/zmqnotificationinterface.h>
diff --git a/src/node/interface_ui.cpp b/src/node/interface_ui.cpp
index d96c5155..525d341e 100644
--- a/src/node/interface_ui.cpp
+++ b/src/node/interface_ui.cpp
@@ -4,12 +4,10 @@
#include <node/interface_ui.h>
+#include <btcsignals.h>
#include <util/string.h>
#include <util/translation.h>
-#include <boost/signals2/optional_last_value.hpp>
-#include <boost/signals2/signal.hpp>
-
using util::MakeUnorderedList;
CClientUIInterface uiInterface;
diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp
index 37524176..f0897c8e 100644
--- a/src/node/interfaces.cpp
+++ b/src/node/interfaces.cpp
@@ -5,6 +5,7 @@
#include <addrdb.h>
#include <banman.h>
#include <blockfilter.h>
+#include <btcsignals.h>
#include <chain.h>
#include <chainparams.h>
#include <common/args.h>
@@ -69,8 +70,6 @@
#include <optional>
#include <utility>
-#include <boost/signals2/signal.hpp>
-
using interfaces::BlockRef;
using interfaces::BlockTemplate;
using interfaces::BlockTip;
diff --git a/src/noui.cpp b/src/noui.cpp
index 327e17f8..af04cb00 100644
--- a/src/noui.cpp
+++ b/src/noui.cpp
@@ -5,15 +5,13 @@
#include <noui.h>
+#include <btcsignals.h>
#include <logging.h>
#include <node/interface_ui.h>
#include <util/translation.h>
#include <string>
-#include <boost/signals2/connection.hpp>
-#include <boost/signals2/signal.hpp>
-
/** Store connections so we can disconnect them when suppressing output */
boost::signals2::connection noui_ThreadSafeMessageBoxConn;
boost::signals2::connection noui_ThreadSafeQuestionConn;
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 92c815fe..cb236bd7 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -6,6 +6,7 @@
#include <qt/bitcoin.h>
+#include <btcsignals.h>
#include <chainparams.h>
#include <common/args.h>
#include <common/init.h>
@@ -44,7 +45,6 @@
#include <wallet/types.h>
#endif // ENABLE_WALLET
-#include <boost/signals2/connection.hpp>
#include <chrono>
#include <memory>
diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h
index 00dd6eed..8647ae48 100644
--- a/src/wallet/scriptpubkeyman.h
+++ b/src/wallet/scriptpubkeyman.h
@@ -6,6 +6,7 @@
#define BITCOIN_WALLET_SCRIPTPUBKEYMAN_H
#include <addresstype.h>
+#include <btcsignals.h>
#include <common/messages.h>
#include <common/signmessage.h>
#include <common/types.h>
@@ -23,8 +24,6 @@
#include <wallet/walletdb.h>
#include <wallet/walletutil.h>
-#include <boost/signals2/signal.hpp>
-
#include <functional>
#include <optional>
#include <unordered_map>
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 4250acca..a46a6455 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -7,6 +7,7 @@
#define BITCOIN_WALLET_WALLET_H
#include <addresstype.h>
+#include <btcsignals.h>
#include <consensus/amount.h>
#include <interfaces/chain.h>
#include <interfaces/handler.h>
@@ -51,8 +52,6 @@
#include <utility>
#include <vector>
-#include <boost/signals2/signal.hpp>
-
class CKey;
class CKeyID;
class CPubKey;
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.