19 if (!
GetKey(address, key)) {
21 WatchKeyMap::const_iterator it = mapWatchKeys.find(address);
22 if (it != mapWatchKeys.end()) {
23 vchPubKeyOut = it->second;
35 mapKeys[pubkey.
GetID()] = key;
41 if (redeemScript.
size() > MAX_SCRIPT_ELEMENT_SIZE)
42 return error(
"CBasicKeyStore::AddCScript(): redeemScripts > %i bytes are invalid", MAX_SCRIPT_ELEMENT_SIZE);
45 mapScripts[
CScriptID(redeemScript)] = redeemScript;
52 return mapScripts.count(hash) > 0;
58 ScriptMap::const_iterator mi = mapScripts.find(hash);
59 if (mi != mapScripts.end())
61 redeemScriptOut = (*mi).second;
72 std::vector<unsigned char> vch;
73 if (!dest.
GetOp(pc, opcode, vch) || vch.size() < 33 || vch.size() > 65)
86 setWatchOnly.insert(dest);
88 if (ExtractPubKey(dest, pubKey))
89 mapWatchKeys[pubKey.
GetID()] = pubKey;
96 setWatchOnly.erase(dest);
98 if (ExtractPubKey(dest, pubKey))
99 mapWatchKeys.erase(pubKey.
GetID());
106 return setWatchOnly.count(dest) > 0;
112 return (!setWatchOnly.empty());
bool error(const char *fmt, const Args &...args)
CCriticalSection cs_KeyStore
virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey)=0
Add a key to the store.
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
virtual bool HaveCScript(const CScriptID &hash) const override
virtual bool GetCScript(const CScriptID &hash, CScript &redeemScriptOut) const override
virtual bool AddCScript(const CScript &redeemScript) override
Support for BIP 0013 : see https://github.com/fabcoin/bips/blob/master/bip-0013.mediawiki.
opcodetype
Script opcodes.
CPubKey GetPubKey() const
Compute the public key from a private key.
An encapsulated public key.
bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) override
Add a key to the store.
virtual bool GetKey(const CKeyID &address, CKey &keyOut) const =0
virtual bool AddKey(const CKey &key)
virtual bool RemoveWatchOnly(const CScript &dest) override
Serialized script, used inside transaction inputs and outputs.
A reference to a CKey: the Hash160 of its serialized public key.
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid()) ...
A reference to a CScript: the Hash160 of its serialization (see script.h)
bool GetOp(iterator &pc, opcodetype &opcodeRet, std::vector< unsigned char > &vchRet)
struct evm_uint160be address(struct evm_env *env)
An encapsulated private key.
virtual bool HaveWatchOnly() const override
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
virtual bool AddWatchOnly(const CScript &dest) override
Support for Watch-only addresses.