diff options
| author | Gavin Andresen <[email protected]> | 2011-12-20 14:43:31 -0500 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2011-12-20 14:43:31 -0500 |
| commit | 595925592d36fb5d5d34beea3c3e71fca2b6726e (patch) | |
| tree | e28c34353aa08a6f3c0368a39982970c08245ea3 /src/keystore.cpp | |
| parent | Merge pull request #717 from TheBlueMatt/installerqtupgrade (diff) | |
| parent | include util.h to get SecureString definition. (diff) | |
| download | discoin-595925592d36fb5d5d34beea3c3e71fca2b6726e.tar.xz discoin-595925592d36fb5d5d34beea3c3e71fca2b6726e.zip | |
Merge branch 'op_eval'
Diffstat (limited to 'src/keystore.cpp')
| -rw-r--r-- | src/keystore.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/keystore.cpp b/src/keystore.cpp index 6cf557faf..21fb0f91b 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -4,8 +4,9 @@ // file license.txt or http://www.opensource.org/licenses/mit-license.php. #include "headers.h" -#include "db.h" #include "crypter.h" +#include "db.h" +#include "script.h" std::vector<unsigned char> CKeyStore::GenerateNewKey() { @@ -33,6 +34,36 @@ bool CBasicKeyStore::AddKey(const CKey& key) return true; } +bool CBasicKeyStore::AddCScript(const uint160 &hash, const CScript& redeemScript) +{ + CRITICAL_BLOCK(cs_KeyStore) + mapScripts[hash] = redeemScript; + return true; +} + +bool CBasicKeyStore::HaveCScript(const uint160& hash) const +{ + bool result; + CRITICAL_BLOCK(cs_KeyStore) + result = (mapScripts.count(hash) > 0); + return result; +} + + +bool CBasicKeyStore::GetCScript(const uint160 &hash, CScript& redeemScriptOut) const +{ + CRITICAL_BLOCK(cs_KeyStore) + { + ScriptMap::const_iterator mi = mapScripts.find(hash); + if (mi != mapScripts.end()) + { + redeemScriptOut = (*mi).second; + return true; + } + } + return false; +} + bool CCryptoKeyStore::SetCrypted() { CRITICAL_BLOCK(cs_KeyStore) |