diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2017-09-07 13:24:20 -0700 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2017-10-04 20:32:04 -0700 |
commit | 3155fd23f2a6180e696269b47fd642caa7b78925 (patch) | |
tree | 5b2d98983fa963177209ed765096ca2ab35d892f /src/keystore.cpp | |
parent | 52f8877525d5238f3440e73710507be889d14127 (diff) |
CKeystore: move relevant implementation out of the header
Diffstat (limited to 'src/keystore.cpp')
-rw-r--r-- | src/keystore.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/keystore.cpp b/src/keystore.cpp index 8454175ca8..d19e9a83d8 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -36,6 +36,36 @@ bool CBasicKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey) return true; } +bool CBasicKeyStore::HaveKey(const CKeyID &address) const +{ + LOCK(cs_KeyStore); + return mapKeys.count(address) > 0; +} + +std::set<CKeyID> CBasicKeyStore::GetKeys() const +{ + LOCK(cs_KeyStore); + std::set<CKeyID> set_address; + for (const auto& mi : mapKeys) { + set_address.insert(mi.first); + } + return set_address; +} + +bool CBasicKeyStore::GetKey(const CKeyID &address, CKey &keyOut) const +{ + { + LOCK(cs_KeyStore); + KeyMap::const_iterator mi = mapKeys.find(address); + if (mi != mapKeys.end()) + { + keyOut = mi->second; + return true; + } + } + return false; +} + bool CBasicKeyStore::AddCScript(const CScript& redeemScript) { if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE) |