diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2011-10-03 13:05:43 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2011-12-19 12:40:19 -0500 |
commit | e679ec969c8b22c676ebb10bea1038f6c8f13b33 (patch) | |
tree | c584f1a152c376ca0df93261d447c5b719449508 /src/keystore.cpp | |
parent | cc40ba2151a627b6da9af4932e0bee58e69aacb5 (diff) |
OP_EVAL implementation
OP_EVAL is a new opcode that evaluates an item on the stack as a script.
It enables a new type of bitcoin address that needs an arbitrarily
complex script to redeem.
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 6cf557fafe..c9b9b4a5de 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -33,6 +33,36 @@ bool CBasicKeyStore::AddKey(const CKey& key) return true; } +bool CBasicKeyStore::AddCScript(const uint160 &hash, const std::vector<unsigned char>& data) +{ + CRITICAL_BLOCK(cs_KeyStore) + mapData[hash] = data; + return true; +} + +bool CBasicKeyStore::HaveCScript(const uint160& hash) const +{ + bool result; + CRITICAL_BLOCK(cs_KeyStore) + result = (mapData.count(hash) > 0); + return result; +} + + +bool CBasicKeyStore::GetCScript(const uint160 &hash, std::vector<unsigned char>& dataOut) const +{ + CRITICAL_BLOCK(cs_KeyStore) + { + DataMap::const_iterator mi = mapData.find(hash); + if (mi != mapData.end()) + { + dataOut = (*mi).second; + return true; + } + } + return false; +} + bool CCryptoKeyStore::SetCrypted() { CRITICAL_BLOCK(cs_KeyStore) |