diff options
| author | Andrew Chow <[email protected]> | 2018-04-12 17:04:49 -0400 |
|---|---|---|
| committer | Andrew Chow <[email protected]> | 2018-05-05 00:43:04 -0400 |
| commit | dd3c07acce7ab67f32a79393abf6227009bd440d (patch) | |
| tree | 758ce969f58e219dc7c813f8b4229cabffd000b6 /src/keystore.cpp | |
| parent | Merge #13163: Make it clear which functions that are intended to be translati... (diff) | |
| download | discoin-dd3c07acce7ab67f32a79393abf6227009bd440d.tar.xz discoin-dd3c07acce7ab67f32a79393abf6227009bd440d.zip | |
Separate HaveKey function that checks whether a key is in a keystore
Diffstat (limited to 'src/keystore.cpp')
| -rw-r--r-- | src/keystore.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/keystore.cpp b/src/keystore.cpp index e69d51889..ea93ed69f 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -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()); +} |