15template <
typename M,
typename K,
typename V>
17 auto it = map.find(key);
18 if (it != map.end()) {
26 CScript &script)
const {
51 CScript &script)
const {
60 std::pair<CPubKey, KeyOriginInfo> out;
63 info = std::move(out.second);
88 if (!
GetKey(address, key)) {
98 mapKeys[pubkey.
GetID()] = key;
104 return mapKeys.count(address) > 0;
109 std::set<CKeyID> set_address;
110 for (
const auto &mi : mapKeys) {
111 set_address.insert(mi.first);
117 CKey &keyOut)
const {
119 KeyMap::const_iterator mi = mapKeys.find(address);
120 if (mi != mapKeys.end()) {
130 "FillableSigningProvider::AddCScript(): redeemScripts > %i bytes "
136 mapScripts[
CScriptID(redeemScript)] = redeemScript;
142 return mapScripts.count(hash) > 0;
147 std::set<CScriptID> set_script;
148 for (
const auto &mi : mapScripts) {
149 set_script.insert(mi.first);
155 CScript &redeemScriptOut)
const {
157 ScriptMap::const_iterator mi = mapScripts.find(hash);
158 if (mi != mapScripts.end()) {
159 redeemScriptOut = (*mi).second;
168 if (
auto id = std::get_if<PKHash>(&dest)) {
An encapsulated secp256k1 private key.
CPubKey GetPubKey() const
Compute the public key from a private key.
A reference to a CKey: the Hash160 of its serialized public key.
An encapsulated public key.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
A reference to a CScript: the Hash160 of its serialization (see script.h)
virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey)
virtual bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
virtual bool GetCScript(const CScriptID &hash, CScript &redeemScriptOut) const override
virtual bool GetKey(const CKeyID &address, CKey &keyOut) const override
virtual bool AddCScript(const CScript &redeemScript)
virtual std::set< CKeyID > GetKeys() const
virtual std::set< CScriptID > GetCScripts() const
virtual bool HaveCScript(const CScriptID &hash) const override
RecursiveMutex cs_KeyStore
virtual bool HaveKey(const CKeyID &address) const override
bool GetKey(const CKeyID &keyid, CKey &key) const override
bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const override
const SigningProvider * m_provider
bool GetPubKey(const CKeyID &keyid, CPubKey &pubkey) const override
bool GetCScript(const CScriptID &scriptid, CScript &script) const override
An interface to be implemented by keystores that support signing.
virtual bool GetCScript(const CScriptID &scriptid, CScript &script) const
virtual bool GetPubKey(const CKeyID &address, CPubKey &pubkey) const
virtual bool GetKey(const CKeyID &address, CKey &key) const
virtual bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const
bool error(const char *fmt, const Args &...args)
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE
const SigningProvider & DUMMY_SIGNING_PROVIDER
FlatSigningProvider Merge(const FlatSigningProvider &a, const FlatSigningProvider &b)
bool LookupHelper(const M &map, const K &key, V &value)
CKeyID GetKeyForDestination(const SigningProvider &store, const CTxDestination &dest)
Return the CKeyID of the key involved in a script (if there is a unique one).
CKeyID ToKeyID(const PKHash &key_hash)
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
bool GetPubKey(const CKeyID &keyid, CPubKey &pubkey) const override
std::map< CKeyID, std::pair< CPubKey, KeyOriginInfo > > origins
bool GetKey(const CKeyID &keyid, CKey &key) const override
std::map< CKeyID, CPubKey > pubkeys
std::map< CKeyID, CKey > keys
bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const override
std::map< CScriptID, CScript > scripts
bool GetCScript(const CScriptID &scriptid, CScript &script) const override