Add GetCScripts to CBasicKeyStore

This commit is contained in:
MeshCollider 2017-11-11 20:49:27 +13:00
parent 18a1bbad98
commit cdc260afd5
2 changed files with 12 additions and 0 deletions

View file

@ -77,6 +77,16 @@ bool CBasicKeyStore::HaveCScript(const CScriptID& hash) const
return mapScripts.count(hash) > 0; return mapScripts.count(hash) > 0;
} }
std::set<CScriptID> CBasicKeyStore::GetCScripts() const
{
LOCK(cs_KeyStore);
std::set<CScriptID> set_script;
for (const auto& mi : mapScripts) {
set_script.insert(mi.first);
}
return set_script;
}
bool CBasicKeyStore::GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const bool CBasicKeyStore::GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const
{ {
LOCK(cs_KeyStore); LOCK(cs_KeyStore);

View file

@ -36,6 +36,7 @@ public:
//! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki //! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki
virtual bool AddCScript(const CScript& redeemScript) =0; virtual bool AddCScript(const CScript& redeemScript) =0;
virtual bool HaveCScript(const CScriptID &hash) const =0; virtual bool HaveCScript(const CScriptID &hash) const =0;
virtual std::set<CScriptID> GetCScripts() const =0;
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0; virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0;
//! Support for Watch-only addresses //! Support for Watch-only addresses
@ -67,6 +68,7 @@ public:
bool GetKey(const CKeyID &address, CKey &keyOut) const override; bool GetKey(const CKeyID &address, CKey &keyOut) const override;
bool AddCScript(const CScript& redeemScript) override; bool AddCScript(const CScript& redeemScript) override;
bool HaveCScript(const CScriptID &hash) const override; bool HaveCScript(const CScriptID &hash) const override;
std::set<CScriptID> GetCScripts() const override;
bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const override; bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const override;
bool AddWatchOnly(const CScript &dest) override; bool AddWatchOnly(const CScript &dest) override;