Skip to content

Commit 290b27d

Browse files
DCG-ClaudePastaPastaPasta
authored andcommitted
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: adds <logging.h> next to Dash's <outputtype.h>, which upstream had already removed - src/wallet/scriptpubkeyman.h: the moved MigrationData keeps Dash's mnemonic, passphrase and chain-counter fields - src/wallet/wallet.cpp: adds <wallet/scriptpubkeyman.h> among Dash's includes; upstream's <wallet/fees.h> context line is not brought in - src/wallet/walletutil.h: drops the forward declarations and MigrationData as upstream does; Dash's WalletDescriptor is unchanged Not applicable to Dash (intentionally omitted): - ci/test/06_script_b.sh: only drops a walletutil exclusion from upstream's tidy filter; Dash removed this script and ci/dash/lint-tidy.sh has no such filter
1 parent 38f3126 commit 290b27d

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
@@ -685,6 +688,29 @@ class DescriptorScriptPubKeyMan : public ScriptPubKeyMan
685688

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

690716
#endif // BITCOIN_WALLET_SCRIPTPUBKEYMAN_H

‎src/wallet/wallet.cpp‎

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

5152
#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)