iwyu: Fix warnings in `src/interfaces` and treat them as errors #35900

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:260805-iwyu-interfaces changing 7 files +22 −27
  1. hebasto commented at 3:15 PM on August 5, 2026: member

    This PR continues the ongoing effort to enforce IWYU warnings.

    See Developer Notes.

  2. DrahtBot commented at 3:15 PM on August 5, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35900.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Stale ACK BrandonOdiwuor

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35436 (wallet: Add addHDkey interface by pseudoramdom)
    • #33117 (Interfaces: Expose UTXO Snapshot Loading and Add Progress Notifications by D33r-Gee)
    • #24230 (indexes: Stop using node internal types and locking cs_main, improve sync logic by ryanofsky)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. hebasto force-pushed on Aug 10, 2026
  4. hebasto commented at 1:21 PM on August 10, 2026: member

    Rebased to refresh the CI.

  5. BrandonOdiwuor commented at 3:36 AM on August 14, 2026: contributor

    ACK ca15a2260d1dcb5162da27cefac25a0398436cf6

    I reviewed the changes and manually tested IWYU enforcement on src/interface (enabled on base commit ca15a2260d1dcb5162da27cefac25a0398436cf6 and compared before/after this PR).

    I have noted the following and they are reasonable:

    • #include <chrono> was replaced by #include <util/time.h>
    • The #include <variant> suggestion related to std::tuple was fixed

    <details> <summary>Suggestions after IWYU enforcement before ca15a2260d1dcb5162da27cefac25a0398436cf6 </summary>

    2026-08-13T07:23:23.3594712Z diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
    2026-08-13T07:23:23.3594959Z index 20369fd..edbba25 100644
    2026-08-13T07:23:23.3595089Z --- a/src/interfaces/chain.h
    2026-08-13T07:23:23.3595202Z +++ b/src/interfaces/chain.h
    2026-08-13T07:23:23.3595364Z @@ -7,11 +7,12 @@
    2026-08-13T07:23:23.3595449Z  
    2026-08-13T07:23:23.3595594Z  #include <blockfilter.h>
    2026-08-13T07:23:23.3595715Z  #include <common/settings.h>
    2026-08-13T07:23:23.3596174Z +#include <consensus/amount.h>
    2026-08-13T07:23:23.3596358Z  #include <kernel/chain.h> // IWYU pragma: export
    2026-08-13T07:23:23.3596485Z -#include <node/types.h>
    2026-08-13T07:23:23.3596628Z  #include <primitives/transaction.h>
    2026-08-13T07:23:23.3596753Z  #include <util/result.h>
    2026-08-13T07:23:23.3596848Z  
    2026-08-13T07:23:23.3596967Z +#include <chrono>
    2026-08-13T07:23:23.3597120Z  #include <cstddef>
    2026-08-13T07:23:23.3597262Z  #include <cstdint>
    2026-08-13T07:23:23.3597370Z  #include <functional>
    2026-08-13T07:23:23.3597471Z @@ -21,9 +22,7 @@
    2026-08-13T07:23:23.3597569Z  #include <string>
    2026-08-13T07:23:23.3597665Z  #include <vector>
    2026-08-13T07:23:23.3597744Z  
    2026-08-13T07:23:23.3597857Z -class ArgsManager;
    2026-08-13T07:23:23.3597959Z  class CBlock;
    2026-08-13T07:23:23.3598098Z -class CBlockUndo;
    2026-08-13T07:23:23.3598212Z  class CFeeRate;
    2026-08-13T07:23:23.3598323Z  class CRPCCommand;
    2026-08-13T07:23:23.3598417Z  class CScheduler;
    2026-08-13T07:23:23.3598590Z @@ -34,17 +33,18 @@ enum class RBFTransactionState;
    2026-08-13T07:23:23.3598704Z  struct bilingual_str;
    2026-08-13T07:23:23.3598826Z  struct CBlockLocator;
    2026-08-13T07:23:23.3598913Z  struct FeeCalculation;
    2026-08-13T07:23:23.3598994Z +
    2026-08-13T07:23:23.3599076Z  namespace kernel {
    2026-08-13T07:23:23.3599166Z  struct ChainstateRole;
    2026-08-13T07:23:23.3599249Z  } // namespace kernel
    2026-08-13T07:23:23.3599369Z  namespace node {
    2026-08-13T07:23:23.3599471Z  struct NodeContext;
    2026-08-13T07:23:23.3599578Z +enum class TxBroadcast : uint8_t;
    2026-08-13T07:23:23.3599657Z  } // namespace node
    2026-08-13T07:23:23.3599737Z  
    2026-08-13T07:23:23.3599819Z  namespace interfaces {
    2026-08-13T07:23:23.3599898Z  
    2026-08-13T07:23:23.3600002Z  class Handler;
    2026-08-13T07:23:23.3600120Z -class Wallet;
    2026-08-13T07:23:23.3600204Z  
    2026-08-13T07:23:23.3600486Z  //! Helper for findBlock to selectively return pieces of block data. If block is
    2026-08-13T07:23:23.3600727Z  //! found, data will be returned by setting specified output variables. If block
    2026-08-13T07:23:23.3600920Z diff --git a/src/interfaces/node.h b/src/interfaces/node.h
    2026-08-13T07:23:23.3601033Z index 8b8402e..415f493 100644
    2026-08-13T07:23:23.3601138Z --- a/src/interfaces/node.h
    2026-08-13T07:23:23.3601246Z +++ b/src/interfaces/node.h
    2026-08-13T07:23:23.3601486Z @@ -11,35 +11,32 @@
    2026-08-13T07:23:23.3601605Z  #include <net_types.h>
    2026-08-13T07:23:23.3601708Z  #include <netaddress.h>
    2026-08-13T07:23:23.3601829Z  #include <netbase.h>
    2026-08-13T07:23:23.3601954Z -#include <support/allocators/secure.h>
    2026-08-13T07:23:23.3602094Z +#include <primitives/transaction.h>
    2026-08-13T07:23:23.3602191Z +#include <uint256.h>
    2026-08-13T07:23:23.3602299Z  #include <util/log.h>
    2026-08-13T07:23:23.3602408Z  #include <util/translation.h>
    2026-08-13T07:23:23.3602499Z  
    2026-08-13T07:23:23.3602596Z  #include <cstddef>
    2026-08-13T07:23:23.3602704Z  #include <cstdint>
    2026-08-13T07:23:23.3602797Z  #include <functional>
    2026-08-13T07:23:23.3602910Z +#include <map>
    2026-08-13T07:23:23.3603012Z  #include <memory>
    2026-08-13T07:23:23.3603120Z  #include <optional>
    2026-08-13T07:23:23.3603208Z  #include <string>
    2026-08-13T07:23:23.3603315Z  #include <tuple>
    2026-08-13T07:23:23.3603416Z +#include <variant>
    2026-08-13T07:23:23.3603516Z  #include <vector>
    2026-08-13T07:23:23.3603607Z  
    2026-08-13T07:23:23.3603705Z -class BanMan;
    2026-08-13T07:23:23.3603799Z  class CFeeRate;
    2026-08-13T07:23:23.3604141Z -class CNodeStats;
    2026-08-13T07:23:23.3604270Z  class Coin;
    2026-08-13T07:23:23.3604412Z  class UniValue;
    2026-08-13T07:23:23.3604523Z -class Proxy;
    2026-08-13T07:23:23.3604651Z  enum class SynchronizationState;
    2026-08-13T07:23:23.3604758Z  struct CNodeStateStats;
    2026-08-13T07:23:23.3604878Z -struct bilingual_str;
    2026-08-13T07:23:23.3604972Z +
    2026-08-13T07:23:23.3605076Z  namespace node {
    2026-08-13T07:23:23.3605197Z  enum class TransactionError;
    2026-08-13T07:23:23.3605308Z  struct NodeContext;
    2026-08-13T07:23:23.3605395Z  } // namespace node
    2026-08-13T07:23:23.3605655Z -namespace wallet {
    2026-08-13T07:23:23.3605761Z -class CCoinControl;
    2026-08-13T07:23:23.3605876Z -} // namespace wallet
    2026-08-13T07:23:23.3605973Z  
    2026-08-13T07:23:23.3606096Z  namespace interfaces {
    2026-08-13T07:23:23.3606193Z  class Handler;
    2026-08-13T07:23:23.3606377Z diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h
    2026-08-13T07:23:23.3606469Z index f78e3da..16ee952 100644
    2026-08-13T07:23:23.3606600Z --- a/src/interfaces/wallet.h
    2026-08-13T07:23:23.3606727Z +++ b/src/interfaces/wallet.h
    2026-08-13T07:23:23.3606826Z @@ -10,36 +10,36 @@
    2026-08-13T07:23:23.3606934Z  #include <common/types.h>
    2026-08-13T07:23:23.3607075Z  #include <consensus/amount.h>
    2026-08-13T07:23:23.3607166Z  #include <interfaces/chain.h>
    2026-08-13T07:23:23.3607365Z -#include <primitives/transaction_identifier.h>
    2026-08-13T07:23:23.3607493Z -#include <pubkey.h>
    2026-08-13T07:23:23.3607609Z -#include <script/script.h>
    2026-08-13T07:23:23.3607743Z +#include <primitives/transaction.h>
    2026-08-13T07:23:23.3607876Z  #include <support/allocators/secure.h>
    2026-08-13T07:23:23.3607992Z  #include <util/fs.h>
    2026-08-13T07:23:23.3608097Z  #include <util/result.h>
    2026-08-13T07:23:23.3608228Z  #include <util/ui_change_type.h>
    2026-08-13T07:23:23.3608307Z  
    2026-08-13T07:23:23.3608409Z +#include <compare>
    2026-08-13T07:23:23.3608509Z +#include <cstddef>
    2026-08-13T07:23:23.3608623Z  #include <cstdint>
    2026-08-13T07:23:23.3608727Z  #include <functional>
    2026-08-13T07:23:23.3608842Z  #include <map>
    2026-08-13T07:23:23.3608939Z  #include <memory>
    2026-08-13T07:23:23.3609053Z +#include <optional>
    2026-08-13T07:23:23.3609154Z +#include <set>
    2026-08-13T07:23:23.3609267Z  #include <string>
    2026-08-13T07:23:23.3609366Z  #include <tuple>
    2026-08-13T07:23:23.3609474Z -#include <type_traits>
    2026-08-13T07:23:23.3609575Z  #include <utility>
    2026-08-13T07:23:23.3609687Z +#include <variant>
    2026-08-13T07:23:23.3609784Z  #include <vector>
    2026-08-13T07:23:23.3609873Z  
    2026-08-13T07:23:23.3609974Z -class CFeeRate;
    2026-08-13T07:23:23.3610079Z -class CKey;
    2026-08-13T07:23:23.3610174Z  enum class FeeReason;
    2026-08-13T07:23:23.3610281Z  enum class OutputType;
    2026-08-13T07:23:23.3610407Z  class PartiallySignedTransaction;
    2026-08-13T07:23:23.3610514Z  struct bilingual_str;
    2026-08-13T07:23:23.3610613Z -namespace common {
    2026-08-13T07:23:23.3610717Z -enum class PSBTError;
    2026-08-13T07:23:23.3610818Z -} // namespace common
    2026-08-13T07:23:23.3610917Z -namespace node {
    2026-08-13T07:23:23.3611036Z -enum class TransactionError;
    2026-08-13T07:23:23.3611145Z -} // namespace node
    2026-08-13T07:23:23.3611249Z +class ArgsManager;
    2026-08-13T07:23:23.3611482Z +class CKeyID;
    2026-08-13T07:23:23.3611596Z +class CPubKey;
    2026-08-13T07:23:23.3611705Z +class CScript;
    2026-08-13T07:23:23.3611801Z +class uint256;
    2026-08-13T07:23:23.3611900Z +
    2026-08-13T07:23:23.3612005Z  namespace wallet {
    2026-08-13T07:23:23.3612149Z  struct CreatedTransactionResult;
    2026-08-13T07:23:23.3612277Z  class CCoinControl;
    

    </details>

  6. fanquake closed this on Aug 18, 2026

  7. fanquake reopened this on Aug 18, 2026

  8. DrahtBot added the label Needs rebase on Aug 21, 2026
  9. iwyu: Add temporary mapping to work around upstream bug d564b0255f
  10. iwyu: Fix warnings in `src/interfaces` and treat them as errors b3ff9c4d68
  11. hebasto force-pushed on Aug 22, 2026
  12. hebasto commented at 9:53 AM on August 22, 2026: member

    Rebased to resolve a conflict with the merged bitcoin/bitcoin#34075.

  13. DrahtBot removed the label Needs rebase on Aug 22, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-08-24 13:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me