0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

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; 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*> CWallet::GetAllScriptPubKeyMans() const
{ {
std::set<ScriptPubKeyMan*> spk_mans; 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 //! Returns all unique ScriptPubKeyMans in m_internal_spk_managers and m_external_spk_managers
std::set<ScriptPubKeyMan*> GetActiveScriptPubKeyMans() const; std::set<ScriptPubKeyMan*> GetActiveScriptPubKeyMans() const;
bool IsActiveScriptPubKeyMan(const ScriptPubKeyMan& spkm) const;
//! Returns all unique ScriptPubKeyMans //! Returns all unique ScriptPubKeyMans
std::set<ScriptPubKeyMan*> GetAllScriptPubKeyMans() const; std::set<ScriptPubKeyMan*> GetAllScriptPubKeyMans() const;