diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-02-16 22:31:20 -0500 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2022-02-16 22:53:27 -0500 |
commit | 3d985d4f43b5344f998bcf6db22d02782e647a2a (patch) | |
tree | fdefc0e4ae06242074abd94575822e2408469e15 | |
parent | 1e8aa02ec5cc2819c67ef40a7573c4b23a4c11cc (diff) | |
download | bitcoin-3d985d4f43b5344f998bcf6db22d02782e647a2a.tar.xz |
wallet: Don't generate keys when privkeys disabled when upgrading
When private keys are disabled, we should not be trying to generate new
keys during upgradewallet.
-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()) { |