Skip to content

Commit 66632e5

Browse files
committed
wallet: Add IsActiveScriptPubKeyMan
Given a ScriptPubKeyMan, it's useful to ask the wallet whether it is currently active.
1 parent fa6a259 commit 66632e5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/wallet/wallet.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3463,6 +3463,17 @@ std::set<ScriptPubKeyMan*> CWallet::GetActiveScriptPubKeyMans() const
34633463
return spk_mans;
34643464
}
34653465

3466+
bool CWallet::IsActiveScriptPubKeyMan(const ScriptPubKeyMan& spkm) const
3467+
{
3468+
for (const auto& [_, ext_spkm] : m_external_spk_managers) {
3469+
if (ext_spkm == &spkm) return true;
3470+
}
3471+
for (const auto& [_, int_spkm] : m_internal_spk_managers) {
3472+
if (int_spkm == &spkm) return true;
3473+
}
3474+
return false;
3475+
}
3476+
34663477
std::set<ScriptPubKeyMan*> CWallet::GetAllScriptPubKeyMans() const
34673478
{
34683479
std::set<ScriptPubKeyMan*> spk_mans;

src/wallet/wallet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
942942

943943
//! Returns all unique ScriptPubKeyMans in m_internal_spk_managers and m_external_spk_managers
944944
std::set<ScriptPubKeyMan*> GetActiveScriptPubKeyMans() const;
945+
bool IsActiveScriptPubKeyMan(const ScriptPubKeyMan& spkm) const;
945946

946947
//! Returns all unique ScriptPubKeyMans
947948
std::set<ScriptPubKeyMan*> GetAllScriptPubKeyMans() const;

0 commit comments

Comments
 (0)