Merge bitcoin/bitcoin#35900: iwyu: Fix warnings in `src/interfaces` and treat them as errors
What changed, and why it matters
This is a routine code cleanup pull request. It adjusts which C++ header files are included in several source files and turns on a stricter automated check for the 'interfaces' directory. There is no change to program logic, no bug fix, and no security-relevant behavior.
No security action needed. Treat as normal build/CI hygiene.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit merges PR #35900, which fixes Include What You Use (IWYU) warnings in src/interfaces/chain.h, src/interfaces/node.h, src/interfaces/wallet.h, src/script/signingprovider.cpp, and src/script/signingprovider.h. It also adds src/interfaces/*.h to the CI IWYU check and adds a temporary IWYU mapping for std::tuple. The changes are purely include/forward-declaration hygiene with no functional code modifications.
Changed components
src/interfaces/chain.hsrc/interfaces/node.hsrc/interfaces/wallet.hsrc/script/signingprovider.cppsrc/script/signingprovider.hci/test/03_test_script.shcontrib/devtools/iwyu/bitcoin.core.impInspect captured patch +22 / −27
### ci/test/03_test_script.sh
@@ -249,6 +249,7 @@ if [[ "${RUN_IWYU}" == true ]]; then
-Xiwyu --max_line_length=160 \
-Xiwyu --check_also='*/common/types\.h' \
-Xiwyu --check_also='*/consensus/*\.h' \
+ -Xiwyu --check_also='*/interfaces/*\.h' \
-Xiwyu --check_also='*/primitives/transaction_identifier\.h' \
2>&1 || true
} | tee /tmp/iwyu_ci.out
### contrib/devtools/iwyu/bitcoin.core.imp
@@ -5,4 +5,8 @@
{ "include": [ "<mmintrin.h>", "private", "<immintrin.h>", "public" ] },
{ "include": [ "<smmintrin.h>", "private", "<immintrin.h>", "public" ] },
{ "include": [ "<tmmintrin.h>", "private", "<immintrin.h>", "public" ] },
+
+ # Workaround for IWYU issue.
+ # See: https://github.com/include-what-you-use/include-what-you-use/issues/2084.
+ { "symbol": ["std::tuple", "private", "<tuple>", "public"] },
]
### src/interfaces/chain.h
@@ -7,12 +7,13 @@
#include <blockfilter.h>
#include <common/settings.h>
+#include <consensus/amount.h>
#include <kernel/chain.h> // IWYU pragma: export
-#include <node/types.h>
#include <primitives/transaction.h>
#include <util/expected.h>
#include <util/fees.h>
#include <util/result.h>
+#include <util/time.h>
#include <cstddef>
#include <cstdint>
@@ -23,9 +24,7 @@
#include <string>
#include <vector>
-class ArgsManager;
class CBlock;
-class CBlockUndo;
class CFeeRate;
class CRPCCommand;
class CScheduler;
@@ -40,12 +39,11 @@ struct ChainstateRole;
} // namespace kernel
namespace node {
struct NodeContext;
+enum class TxBroadcast : uint8_t;
} // namespace node
namespace interfaces {
-
class Handler;
-class Wallet;
//! Helper for findBlock to selectively return pieces of block data. If block is
//! found, data will be returned by setting specified output variables. If block
### src/interfaces/node.h
@@ -11,35 +11,30 @@
#include <net_types.h>
#include <netaddress.h>
#include <netbase.h>
-#include <support/allocators/secure.h>
+#include <primitives/transaction.h>
+#include <uint256.h>
#include <util/log.h>
#include <util/translation.h>
#include <cstddef>
#include <cstdint>
#include <functional>
+#include <map>
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <vector>
-class BanMan;
class CFeeRate;
-class CNodeStats;
class Coin;
class UniValue;
-class Proxy;
enum class SynchronizationState;
struct CNodeStateStats;
-struct bilingual_str;
namespace node {
enum class TransactionError;
struct NodeContext;
} // namespace node
-namespace wallet {
-class CCoinControl;
-} // namespace wallet
namespace interfaces {
class Handler;
### src/interfaces/wallet.h
@@ -10,37 +10,34 @@
#include <common/types.h>
#include <consensus/amount.h>
#include <interfaces/chain.h>
-#include <primitives/transaction_identifier.h>
-#include <pubkey.h>
-#include <script/script.h>
+#include <primitives/transaction.h>
#include <support/allocators/secure.h>
#include <util/fs.h>
#include <util/result.h>
#include <util/ui_change_type.h>
+#include <compare>
+#include <cstddef>
#include <cstdint>
#include <functional>
#include <map>
#include <memory>
#include <optional>
+#include <set>
#include <string>
#include <tuple>
-#include <type_traits>
#include <utility>
#include <vector>
-class CFeeRate;
-class CKey;
+class ArgsManager;
+class CKeyID;
+class CPubKey;
+class CScript;
+class PartiallySignedTransaction;
+class uint256;
enum class FeeReason;
enum class OutputType;
-class PartiallySignedTransaction;
struct bilingual_str;
-namespace common {
-enum class PSBTError;
-} // namespace common
-namespace node {
-enum class TransactionError;
-} // namespace node
namespace wallet {
struct CreatedTransactionResult;
class CCoinControl;
### src/script/signingprovider.cpp
@@ -13,6 +13,7 @@
#include <algorithm>
#include <cstddef>
+#include <variant>
const SigningProvider& DUMMY_SIGNING_PROVIDER = SigningProvider();
### src/script/signingprovider.h
@@ -25,7 +25,6 @@
#include <span>
#include <tuple>
#include <utility>
-#include <variant>
#include <vector>
class MuSig2SecNonce;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.