diff options
author | laanwj <126646+laanwj@users.noreply.github.com> | 2022-02-28 13:00:14 +0100 |
---|---|---|
committer | laanwj <126646+laanwj@users.noreply.github.com> | 2022-02-28 13:15:11 +0100 |
commit | 159f89c118645c0f9e23e453f01cede84abac795 (patch) | |
tree | 7c7669517e72d982651a8077eb82113236ae8c3d /src/wallet | |
parent | c7da61dcc37411f7d6dc848cef1ae997703bd37b (diff) | |
parent | c7376cc8d728f3a7c40f79bd57e7cef685def723 (diff) |
Merge bitcoin/bitcoin#24365: wallet: Don't generate keys for wallets with private keys disabled during upgradewallet
c7376cc8d728f3a7c40f79bd57e7cef685def723 tests: Test upgrading wallet with privkeys disabled (Andrew Chow)
3d985d4f43b5344f998bcf6db22d02782e647a2a wallet: Don't generate keys when privkeys disabled when upgrading (Andrew Chow)
Pull request description:
When we're upgrading a wallet, we shouldn't be trying to generate new keys for wallets where private keys are disabled.
Fixes #23610
ACKs for top commit:
laanwj:
Code review ACK c7376cc8d728f3a7c40f79bd57e7cef685def723
benthecarman:
tACK c7376cc8d728f3a7c40f79bd57e7cef685def723 this fixed the issue for me
Tree-SHA512: fa07cf37df9196ff98671bb1ce5c9aa0bab46495066b4dab796d7e8e5d5c7adb414ff56adae4fd3e15658a610995bd19a9e1edb00c46144b0df635c5b343f3a6
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/scriptpubkeyman.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 7218ed11dc..53f7b773b4 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -469,6 +469,12 @@ bool LegacyScriptPubKeyMan::CanGetAddresses(bool internal) const bool LegacyScriptPubKeyMan::Upgrade(int prev_version, int new_version, bilingual_str& error) { LOCK(cs_KeyStore); + + if (m_storage.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) { + // Nothing to do here if private keys are not enabled + return true; + } + bool hd_upgrade = false; bool split_upgrade = false; if (IsFeatureSupported(new_version, FEATURE_HD) && !IsHDEnabled()) { |