20 if (!
GetKey(address, key)) {
22 WatchKeyMap::const_iterator it = mapWatchKeys.find(address);
23 if (it != mapWatchKeys.end()) {
24 vchPubKeyOut = it->second;
36 mapKeys[pubkey.
GetID()] = key;
42 if (redeemScript.
size() > MAX_SCRIPT_ELEMENT_SIZE)
43 return error(
"CBasicKeyStore::AddCScript(): redeemScripts > %i bytes are invalid", MAX_SCRIPT_ELEMENT_SIZE);
46 mapScripts[
CScriptID(redeemScript)] = redeemScript;
53 return mapScripts.count(hash) > 0;
59 ScriptMap::const_iterator mi = mapScripts.find(hash);
60 if (mi != mapScripts.end())
62 redeemScriptOut = (*mi).second;
73 std::vector<unsigned char> vch;
74 if (!dest.
GetOp(pc, opcode, vch) || vch.size() < 33 || vch.size() > 65)
87 setWatchOnly.insert(dest);
89 if (ExtractPubKey(dest, pubKey))
90 mapWatchKeys[pubKey.
GetID()] = pubKey;
97 setWatchOnly.erase(dest);
99 if (ExtractPubKey(dest, pubKey))
100 mapWatchKeys.erase(pubKey.
GetID());
107 return setWatchOnly.count(dest) > 0;
113 return (!setWatchOnly.empty());
CCriticalSection cs_KeyStore
virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey)=0
Add a key to the store.
CPubKey GetPubKey() const
Compute the public key from a private key.
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
bool HaveCScript(const CScriptID &hash) const override
bool GetCScript(const CScriptID &hash, CScript &redeemScriptOut) const override
bool AddCScript(const CScript &redeemScript) override
Support for BIP 0013 : see https://github.com/raven/bips/blob/master/bip-0013.mediawiki.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
opcodetype
Script opcodes.
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid()) ...
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)
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 error(const char *fmt, const Args &... args)
A reference to a CScript: the Hash160 of its serialization (see script.h)
bool GetOp(iterator &pc, opcodetype &opcodeRet, std::vector< unsigned char > &vchRet)
An encapsulated private key.
bool HaveWatchOnly() const override
bool AddWatchOnly(const CScript &dest) override
Support for Watch-only addresses.