Skip to content

Commit f523d50

Browse files
committed
Merge bitcoin#27759: Fix #includes in src/wallet
1f97572 Fix `#include`s in `src/wallet` (Hennadii Stepanov) Pull request description: This PR is a minimum required changes to fix bitcoin#27571 (comment). ACKs for top commit: MarcoFalke: lgtm ACK 1f97572 Tree-SHA512: de885210076d23f3394c42ca50e6ae2470c0ae6523399a2fa3ebb7c06383bdacef9c26166fa19747200396bed796c8772165e24416eb30ed8edd024e3394b2fe Dash adaptations: - src/wallet/scriptpubkeyman.h: added #include <logging.h> next to Dash's existing #include <outputtype.h> (upstream had removed outputtype.h before this PR; Dash still includes it), kept alphabetical - src/wallet/scriptpubkeyman.h: the MigrationData struct moved here from walletutil.h is Dash's version, keeping the Dash-only fields mnemonic, mnemonic_passphrase, external_chain_counter, internal_chain_counter and their comment; upstream's copy lacks them - src/wallet/wallet.cpp: added #include <wallet/scriptpubkeyman.h> after Dash's <wallet/platformkeys.h>; did not bring in upstream's context line <wallet/fees.h>, which Dash's wallet.cpp does not include; all Dash includes (warnings.h, coinjoin/options.h, evo/providertx.h, governance/vote.h) kept - src/wallet/walletutil.h: removed the forward declarations and the Dash MigrationData struct as upstream does; kept Dash's own WalletDescriptor (id(DescriptorID(*descriptor)) and its existing formatting) unchanged - ci/test/06_script_b.sh: Dash had deleted this file and upstream modified it; resolved by keeping it deleted (git rm), see omitted_hunks Not applicable to Dash (intentionally omitted): - ci/test/06_script_b.sh: The hunk only removes the temporary 'src/wallet/walletutil' exclusion from upstream's jq filter on compile_commands.json. Dash removed this script; its counterpart ci/dash/lint-tidy.sh has no jq filter and no walletutil exclusion (and its IWYU file list has no src/wallet files), so there is nothing to remove there.
1 parent 3240908 commit f523d50

3 files changed

Lines changed: 27 additions & 25 deletions

File tree

‎src/wallet/scriptpubkeyman.h‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#ifndef BITCOIN_WALLET_SCRIPTPUBKEYMAN_H
66
#define BITCOIN_WALLET_SCRIPTPUBKEYMAN_H
77

8+
#include <logging.h>
89
#include <outputtype.h>
910
#include <psbt.h>
1011
#include <script/descriptor.h>
@@ -27,6 +28,8 @@
2728
#include <optional>
2829

2930
namespace wallet {
31+
struct MigrationData;
32+
3033
// Wallet storage things that ScriptPubKeyMans need in order to be able to store things to the wallet database.
3134
// It provides access to things that are part of the entire wallet and not specific to a ScriptPubKeyMan such as
3235
// wallet flags, wallet version, encryption keys, encryption status, and the database itself. This allows a
@@ -684,6 +687,29 @@ class DescriptorScriptPubKeyMan : public ScriptPubKeyMan
684687

685688
void UpgradeDescriptorCache();
686689
};
690+
691+
/** struct containing information needed for migrating legacy wallets to descriptor wallets */
692+
struct MigrationData
693+
{
694+
CExtKey master_key;
695+
SecureString mnemonic;
696+
SecureString mnemonic_passphrase;
697+
// Highest BIP44 index the legacy wallet ever derived per chain (external/0,
698+
// internal/1). The active pkh() descriptors created during migration must
699+
// start handing out the next address from this index, otherwise post-
700+
// migration getnewaddress would re-derive addresses the legacy wallet had
701+
// already given out. Carried via MigrationData purely to advance the active
702+
// descriptors' next_index — the inactive combo descriptors built in
703+
// MigrateToDescriptor already cover the history themselves.
704+
uint32_t external_chain_counter{0};
705+
uint32_t internal_chain_counter{0};
706+
std::vector<std::pair<std::string, int64_t>> watch_descs;
707+
std::vector<std::pair<std::string, int64_t>> solvable_descs;
708+
std::vector<std::unique_ptr<DescriptorScriptPubKeyMan>> desc_spkms;
709+
std::shared_ptr<CWallet> watchonly_wallet{nullptr};
710+
std::shared_ptr<CWallet> solvable_wallet{nullptr};
711+
};
712+
687713
} // namespace wallet
688714

689715
#endif // BITCOIN_WALLET_SCRIPTPUBKEYMAN_H

‎src/wallet/wallet.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <wallet/context.h>
4646
#include <wallet/external_signer_scriptpubkeyman.h>
4747
#include <wallet/platformkeys.h>
48+
#include <wallet/scriptpubkeyman.h>
4849
#include <warnings.h>
4950

5051
#include <coinjoin/options.h>

‎src/wallet/walletutil.h‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -101,31 +101,6 @@ class WalletDescriptor
101101
WalletDescriptor() {}
102102
WalletDescriptor(std::shared_ptr<Descriptor> descriptor, uint64_t creation_time, int32_t range_start, int32_t range_end, int32_t next_index) : descriptor(descriptor), id(DescriptorID(*descriptor)), creation_time(creation_time), range_start(range_start), range_end(range_end), next_index(next_index) { }
103103
};
104-
105-
class CWallet;
106-
class DescriptorScriptPubKeyMan;
107-
108-
/** struct containing information needed for migrating legacy wallets to descriptor wallets */
109-
struct MigrationData
110-
{
111-
CExtKey master_key;
112-
SecureString mnemonic;
113-
SecureString mnemonic_passphrase;
114-
// Highest BIP44 index the legacy wallet ever derived per chain (external/0,
115-
// internal/1). The active pkh() descriptors created during migration must
116-
// start handing out the next address from this index, otherwise post-
117-
// migration getnewaddress would re-derive addresses the legacy wallet had
118-
// already given out. Carried via MigrationData purely to advance the active
119-
// descriptors' next_index — the inactive combo descriptors built in
120-
// MigrateToDescriptor already cover the history themselves.
121-
uint32_t external_chain_counter{0};
122-
uint32_t internal_chain_counter{0};
123-
std::vector<std::pair<std::string, int64_t>> watch_descs;
124-
std::vector<std::pair<std::string, int64_t>> solvable_descs;
125-
std::vector<std::unique_ptr<DescriptorScriptPubKeyMan>> desc_spkms;
126-
std::shared_ptr<CWallet> watchonly_wallet{nullptr};
127-
std::shared_ptr<CWallet> solvable_wallet{nullptr};
128-
};
129104
} // namespace wallet
130105

131106
#endif // BITCOIN_WALLET_WALLETUTIL_H

0 commit comments

Comments
 (0)