aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-12-09 14:55:38 -0500
committerAva Chow <github@achow101.com>2024-12-09 15:25:57 -0500
commit62b2d23edbad76c1d68bb8c0fc8af54e7c0d7dc8 (patch)
treeab7efdc2a9f4ed0f2f7e1b6886e4e39b4e8b5773 /src
parent9039d8f1a1dfe080321f119e1bda2255e1cfdeb9 (diff)
wallet: Migrate non-HD keys to combo() descriptor
Non-HD keys in legacy wallets without a HD seed ID were being migrated to separate pk(), pkh(), sh(wpkh()), and wpkh() descriptors for each key. These could be more compactly represented as combo() descriptors, so migration should make combo() for them. It is possible that existing non-HD wallets that were migrated, or wallets that started blank and had private keys imported into them have run into this issue. However, as the 4 descriptors produce the same output scripts as the single combo(), so any previously migrated wallets are not missing any output scripts. The only observable difference should be performance related, and the wallet size on disk.
Diffstat (limited to 'src')
-rw-r--r--src/wallet/scriptpubkeyman.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp
index 62384056dc..23e2257b1e 100644
--- a/src/wallet/scriptpubkeyman.cpp
+++ b/src/wallet/scriptpubkeyman.cpp
@@ -1799,7 +1799,7 @@ std::optional<MigrationData> LegacyDataSPKM::MigrateToDescriptor()
keyid_it++;
continue;
}
- if (m_hd_chain.seed_id == meta.hd_seed_id || m_inactive_hd_chains.count(meta.hd_seed_id) > 0) {
+ if (!meta.hd_seed_id.IsNull() && (m_hd_chain.seed_id == meta.hd_seed_id || m_inactive_hd_chains.count(meta.hd_seed_id) > 0)) {
keyid_it = keyids.erase(keyid_it);
continue;
}