Merge support for watch-only addresses
[novacoin.git] / src / keystore.cpp
index e0cf805..564c49c 100644 (file)
@@ -6,6 +6,8 @@
 #include "keystore.h"
 #include "script.h"
 
+extern bool fWalletUnlockMintOnly;
+
 bool CKeyStore::GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
 {
     CKey key;
@@ -60,6 +62,19 @@ bool CBasicKeyStore::GetCScript(const CScriptID &hash, CScript& redeemScriptOut)
     return false;
 }
 
+bool CBasicKeyStore::AddWatchOnly(const CTxDestination &dest)
+{
+    LOCK(cs_KeyStore);
+    setWatchOnly.insert(dest);
+    return true;
+}
+
+bool CBasicKeyStore::HaveWatchOnly(const CTxDestination &dest) const
+{
+    LOCK(cs_KeyStore);
+    return setWatchOnly.count(dest) > 0;
+}
+
 bool CCryptoKeyStore::SetCrypted()
 {
     {
@@ -81,6 +96,7 @@ bool CCryptoKeyStore::Lock()
     {
         LOCK(cs_KeyStore);
         vMasterKey.clear();
+        fWalletUnlockMintOnly = false;
     }
 
     NotifyStatusChanged(this);