From a0e9aac42802f6e22c5a227abcd16784d94d881d Mon Sep 17 00:00:00 2001 From: jeanpablo Date: Sun, 30 Aug 2026 15:39:01 +0100 Subject: [PATCH] wallet: remove unused DescriptorScriptPubKeyMan::AddDescriptorKey The private method has no callers. It opened a `WalletBatch` and forwarded to `AddDescriptorKeyWithDB`, which is still called from two other places. Its last caller, in `CWallet::AddWalletDescriptor`, was replaced in aa4f7823aa ("wallet: include keys when constructing DescriptorSPKM during import"), which builds the manager with `CreateFromMigration` instead of adding the key afterwards. --- src/wallet/scriptpubkeyman.cpp | 9 --------- src/wallet/scriptpubkeyman.h | 1 - 2 files changed, 10 deletions(-) diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 30742753602..d42ce4adb08 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -1173,15 +1173,6 @@ std::vector DescriptorScriptPubKeyMan::MarkUnusedAddresses(co return result; } -void DescriptorScriptPubKeyMan::AddDescriptorKey(const CKey& key, const CPubKey &pubkey) -{ - LOCK(cs_desc_man); - WalletBatch batch(m_storage.GetDatabase()); - if (!AddDescriptorKeyWithDB(batch, key, pubkey)) { - throw std::runtime_error(std::string(__func__) + ": writing descriptor private key failed"); - } -} - bool DescriptorScriptPubKeyMan::AddDescriptorKeyWithDB(WalletBatch& batch, const CKey& key, const CPubKey &pubkey) { AssertLockHeld(cs_desc_man); diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h index 5c977b12d40..b41bd50cfd2 100644 --- a/src/wallet/scriptpubkeyman.h +++ b/src/wallet/scriptpubkeyman.h @@ -321,7 +321,6 @@ private: void Load(); - void AddDescriptorKey(const CKey& key, const CPubKey &pubkey); void UpdateWithSigningProvider(WalletBatch& batch, const FlatSigningProvider& signing_provider) EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man); //! Setup descriptors based on the given CExtKey