aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/crypter.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-09-07 13:25:43 -0700
committerJonas Schnelli <dev@jonasschnelli.ch>2017-10-04 20:32:09 -0700
commit208fda69b3989c6f8a2c5bd9ae6558484a377e2a (patch)
tree7a29464ff08b900b6a0dce8c3fbc72eba648f691 /src/wallet/crypter.cpp
parent3155fd23f2a6180e696269b47fd642caa7b78925 (diff)
downloadbitcoin-208fda69b3989c6f8a2c5bd9ae6558484a377e2a.tar.xz
CCrypter: move relevant implementation out of the header
Diffstat (limited to 'src/wallet/crypter.cpp')
-rw-r--r--src/wallet/crypter.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/wallet/crypter.cpp b/src/wallet/crypter.cpp
index dcce88cedc..3b35003807 100644
--- a/src/wallet/crypter.cpp
+++ b/src/wallet/crypter.cpp
@@ -153,6 +153,18 @@ bool CCryptoKeyStore::SetCrypted()
return true;
}
+bool CCryptoKeyStore::IsLocked() const
+{
+ if (!IsCrypted())
+ return false;
+ bool result;
+ {
+ LOCK(cs_KeyStore);
+ result = vMasterKey.empty();
+ }
+ return result;
+}
+
bool CCryptoKeyStore::Lock()
{
if (!SetCrypted())
@@ -239,6 +251,18 @@ bool CCryptoKeyStore::AddCryptedKey(const CPubKey &vchPubKey, const std::vector<
return true;
}
+bool CCryptoKeyStore::HaveKey(const CKeyID &address) const
+{
+ {
+ LOCK(cs_KeyStore);
+ if (!IsCrypted()) {
+ return CBasicKeyStore::HaveKey(address);
+ }
+ return mapCryptedKeys.count(address) > 0;
+ }
+ return false;
+}
+
bool CCryptoKeyStore::GetKey(const CKeyID &address, CKey& keyOut) const
{
{
@@ -275,6 +299,19 @@ bool CCryptoKeyStore::GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) co
}
}
+std::set<CKeyID> CCryptoKeyStore::GetKeys() const
+{
+ LOCK(cs_KeyStore);
+ if (!IsCrypted()) {
+ return CBasicKeyStore::GetKeys();
+ }
+ std::set<CKeyID> set_address;
+ for (const auto& mi : mapCryptedKeys) {
+ set_address.insert(mi.first);
+ }
+ return set_address;
+}
+
bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
{
{