Separate HaveKey function that checks whether a key is in a keystore

This commit is contained in:
Andrew Chow
2018-04-12 17:04:49 -04:00
parent f82e1c9482
commit dd3c07acce
2 changed files with 10 additions and 0 deletions
+7
View File
@@ -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());
}