aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-02-15 11:43:13 -0500
committerAva Chow <github@achow101.com>2024-02-16 14:36:10 -0500
commite041ed9b755468d205ed48b29f6c4b9e9df8bc9f (patch)
tree7d4dd3c94c2a274f4f0f859120ca8c834b5e42f6 /src/wallet/wallet.cpp
parent39640dd34e980e69d13664ddbc2a7612a1888ab4 (diff)
downloadbitcoin-e041ed9b755468d205ed48b29f6c4b9e9df8bc9f.tar.xz
wallet: Retrieve ID from loaded DescSPKM directly
Instead of iterating m_spk_managers a DescriptorSPKM has been loaded in order to get it's ID to compare, have LoadDescriptorSPKM return a reference to the loaded DescriptorSPKM so it can be queried directly.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index ad09dcd38d..4259565a83 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3556,15 +3556,16 @@ void CWallet::ConnectScriptPubKeyManNotifiers()
}
}
-void CWallet::LoadDescriptorScriptPubKeyMan(uint256 id, WalletDescriptor& desc)
+DescriptorScriptPubKeyMan& CWallet::LoadDescriptorScriptPubKeyMan(uint256 id, WalletDescriptor& desc)
{
+ DescriptorScriptPubKeyMan* spk_manager;
if (IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER)) {
- auto spk_manager = std::unique_ptr<ScriptPubKeyMan>(new ExternalSignerScriptPubKeyMan(*this, desc, m_keypool_size));
- AddScriptPubKeyMan(id, std::move(spk_manager));
+ spk_manager = new ExternalSignerScriptPubKeyMan(*this, desc, m_keypool_size);
} else {
- auto spk_manager = std::unique_ptr<ScriptPubKeyMan>(new DescriptorScriptPubKeyMan(*this, desc, m_keypool_size));
- AddScriptPubKeyMan(id, std::move(spk_manager));
+ spk_manager = new DescriptorScriptPubKeyMan(*this, desc, m_keypool_size);
}
+ AddScriptPubKeyMan(id, std::unique_ptr<ScriptPubKeyMan>(spk_manager));
+ return *spk_manager;
}
void CWallet::SetupDescriptorScriptPubKeyMans(const CExtKey& master_key)