Changeset View
Changeset View
Standalone View
Standalone View
src/keystore.cpp
Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | |||||
bool CBasicKeyStore::HaveWatchOnly() const { | bool CBasicKeyStore::HaveWatchOnly() const { | ||||
LOCK(cs_KeyStore); | LOCK(cs_KeyStore); | ||||
return (!setWatchOnly.empty()); | return (!setWatchOnly.empty()); | ||||
} | } | ||||
CKeyID GetKeyForDestination(const CKeyStore &store, | CKeyID GetKeyForDestination(const CKeyStore &store, | ||||
const CTxDestination &dest) { | const CTxDestination &dest) { | ||||
// Only supports destinations which map to single public keys, i.e. P2PKH. | // Only supports destinations which map to single public keys, i.e. P2PKH. | ||||
if (auto id = boost::get<CKeyID>(&dest)) { | if (auto id = boost::get<PKHash>(&dest)) { | ||||
return *id; | return CKeyID(*id); | ||||
} | } | ||||
return CKeyID(); | return CKeyID(); | ||||
} | } | ||||
bool HaveKey(const CKeyStore &store, const CKey &key) { | bool HaveKey(const CKeyStore &store, const CKey &key) { | ||||
CKey key2; | CKey key2; | ||||
key2.Set(key.begin(), key.end(), !key.IsCompressed()); | key2.Set(key.begin(), key.end(), !key.IsCompressed()); | ||||
return store.HaveKey(key.GetPubKey().GetID()) || | return store.HaveKey(key.GetPubKey().GetID()) || | ||||
store.HaveKey(key2.GetPubKey().GetID()); | store.HaveKey(key2.GetPubKey().GetID()); | ||||
} | } |