mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Separate HaveKey function that checks whether a key is in a keystore
This commit is contained in:
parent
f82e1c9482
commit
dd3c07acce
@ -195,3 +195,10 @@ CKeyID GetKeyForDestination(const CKeyStore& store, const CTxDestination& dest)
|
||||
}
|
||||
return CKeyID();
|
||||
}
|
||||
|
||||
bool HaveKey(const CKeyStore& store, const CKey& key)
|
||||
{
|
||||
CKey key2;
|
||||
key2.Set(key.begin(), key.end(), !key.IsCompressed());
|
||||
return store.HaveKey(key.GetPubKey().GetID()) || store.HaveKey(key2.GetPubKey().GetID());
|
||||
}
|
||||
|
@ -80,4 +80,7 @@ typedef std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char> > > Crypt
|
||||
/** Return the CKeyID of the key involved in a script (if there is a unique one). */
|
||||
CKeyID GetKeyForDestination(const CKeyStore& store, const CTxDestination& dest);
|
||||
|
||||
/** Checks if a CKey is in the given CKeyStore compressed or otherwise*/
|
||||
bool HaveKey(const CKeyStore& store, const CKey& key);
|
||||
|
||||
#endif // BITCOIN_KEYSTORE_H
|
||||
|
Loading…
Reference in New Issue
Block a user