wallet: Add IsActiveScriptPubKeyMan

Given a ScriptPubKeyMan, it's useful to ask the wallet whether it is
currently active.
This commit is contained in:
Ava Chow 2023-12-21 17:33:19 -05:00
parent fa6a259985
commit 66632e5c24
2 changed files with 12 additions and 0 deletions

View File

@ -3463,6 +3463,17 @@ std::set<ScriptPubKeyMan*> CWallet::GetActiveScriptPubKeyMans() const
return spk_mans;
}
bool CWallet::IsActiveScriptPubKeyMan(const ScriptPubKeyMan& spkm) const
{
for (const auto& [_, ext_spkm] : m_external_spk_managers) {
if (ext_spkm == &spkm) return true;
}
for (const auto& [_, int_spkm] : m_internal_spk_managers) {
if (int_spkm == &spkm) return true;
}
return false;
}
std::set<ScriptPubKeyMan*> CWallet::GetAllScriptPubKeyMans() const
{
std::set<ScriptPubKeyMan*> spk_mans;

View File

@ -942,6 +942,7 @@ public:
//! Returns all unique ScriptPubKeyMans in m_internal_spk_managers and m_external_spk_managers
std::set<ScriptPubKeyMan*> GetActiveScriptPubKeyMans() const;
bool IsActiveScriptPubKeyMan(const ScriptPubKeyMan& spkm) const;
//! Returns all unique ScriptPubKeyMans
std::set<ScriptPubKeyMan*> GetAllScriptPubKeyMans() const;