Currently, a caller that includes only <interfaces/wallet.h> and uses Wallet::addHDKey() can fail to compile unless it also includes <wallet/hd_keys.h>.
The reason is that addHDKey() is declared as:
virtual util::Expected<wallet::Fingerprint, wallet::AddHDKeyError> addHDKey() = 0;
But wallet::AddHDKeyError is only forward-declared in interfaces/wallet.h.
Because util::Expected stores the error type, callers need the complete definition of AddHDKeyError when they instantiate or inspect the result.
If the intent is for callers to use the wallet interface by including only <interfaces/wallet.h>, a possible fix is to move the public AddHDKey result and error types into a lightweight public header and include that from interfaces/wallet.h.
Suggested patch:
<details>
<summary>diff</summary>
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h
index 993a0f694f..8930d2b120 100644
--- a/src/interfaces/wallet.h
+++ b/src/interfaces/wallet.h
@@ -18,6 +18,7 @@
#include <util/fs.h>
#include <util/result.h>
#include <util/ui_change_type.h>
+#include <wallet/hd_key_types.h>
#include <wallet/types.h>
#include <cstdint>
@@ -43,7 +44,6 @@ namespace node {
enum class TransactionError;
} // namespace node
namespace wallet {
-struct AddHDKeyError;
struct CreatedTransactionResult;
class CCoinControl;
class CWallet;
diff --git a/src/wallet/hd_key_types.h b/src/wallet/hd_key_types.h
new file mode 100644
index 0000000000..b8bea0ba41
--- /dev/null
+++ b/src/wallet/hd_key_types.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2026-present 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_WALLET_HD_KEY_TYPES_H
+#define BITCOIN_WALLET_HD_KEY_TYPES_H
+
+#include <util/translation.h>
+#include <wallet/types.h>
+
+#include <string>
+
+namespace wallet {
+
+struct AddHDKeyResult {
+ Fingerprint fingerprint;
+ std::string xpub;
+};
+
+enum class AddHDKeyErrorCode {
+ PRIVATE_KEYS_DISABLED,
+ WALLET_LOCKED,
+ DUPLICATE_KEY,
+ DESCRIPTOR_ADD_FAILED
+};
+
+struct AddHDKeyError {
+ AddHDKeyErrorCode code;
+ bilingual_str message;
+};
+
+} // namespace wallet
+
+#endif // BITCOIN_WALLET_HD_KEY_TYPES_H
diff --git a/src/wallet/hd_keys.h b/src/wallet/hd_keys.h
index a4baedc730..29fdb7cff2 100644
--- a/src/wallet/hd_keys.h
+++ b/src/wallet/hd_keys.h
@@ -7,33 +7,14 @@
#include <key.h>
#include <util/expected.h>
-#include <util/translation.h>
-#include <wallet/types.h>
+#include <wallet/hd_key_types.h>
#include <optional>
-#include <string>
namespace wallet {
class CWallet;
-struct AddHDKeyResult {
- Fingerprint fingerprint;
- std::string xpub;
-};
-
-enum class AddHDKeyErrorCode {
- PRIVATE_KEYS_DISABLED,
- WALLET_LOCKED,
- DUPLICATE_KEY,
- DESCRIPTOR_ADD_FAILED
-};
-
-struct AddHDKeyError {
- AddHDKeyErrorCode code;
- bilingual_str message;
-};
-
util::Expected<AddHDKeyResult, AddHDKeyError> AddHDKey(CWallet& wallet, const std::optional<CExtKey>& existing_key);
} // namespace wallet
diff --git a/src/wallet/test/hd_keys_tests.cpp b/src/wallet/test/hd_keys_tests.cpp
index 219a5870ad..485d64dd5b 100644
--- a/src/wallet/test/hd_keys_tests.cpp
+++ b/src/wallet/test/hd_keys_tests.cpp
@@ -5,7 +5,6 @@
#include <interfaces/wallet.h>
#include <test/util/setup_common.h>
#include <wallet/context.h>
-#include <wallet/hd_keys.h>
#include <wallet/test/util.h>
#include <wallet/wallet.h>
</details>