From cdc260afd530165a3167e049b630bc177a1398f9 Mon Sep 17 00:00:00 2001 From: MeshCollider Date: Sat, 11 Nov 2017 20:49:27 +1300 Subject: [PATCH] Add GetCScripts to CBasicKeyStore --- src/keystore.cpp | 10 ++++++++++ src/keystore.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/keystore.cpp b/src/keystore.cpp index 4ab089e03..a010a1244 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -77,6 +77,16 @@ bool CBasicKeyStore::HaveCScript(const CScriptID& hash) const return mapScripts.count(hash) > 0; } +std::set CBasicKeyStore::GetCScripts() const +{ + LOCK(cs_KeyStore); + std::set set_script; + for (const auto& mi : mapScripts) { + set_script.insert(mi.first); + } + return set_script; +} + bool CBasicKeyStore::GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const { LOCK(cs_KeyStore); diff --git a/src/keystore.h b/src/keystore.h index 4e6d8e8a2..516a23824 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -36,6 +36,7 @@ public: //! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki virtual bool AddCScript(const CScript& redeemScript) =0; virtual bool HaveCScript(const CScriptID &hash) const =0; + virtual std::set GetCScripts() const =0; virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0; //! Support for Watch-only addresses @@ -67,6 +68,7 @@ public: bool GetKey(const CKeyID &address, CKey &keyOut) const override; bool AddCScript(const CScript& redeemScript) override; bool HaveCScript(const CScriptID &hash) const override; + std::set GetCScripts() const override; bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const override; bool AddWatchOnly(const CScript &dest) override;