diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-06-06 16:49:52 +0200 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2019-07-09 16:20:12 -0400 |
commit | a913e3f2fbeb1352fc66f334d4f5f7332ea89ad7 (patch) | |
tree | 72bd15fc29edf598ed19f61959a78d9270033768 /src/wallet/rpcwallet.cpp | |
parent | c7797ec65544bd23a2e571b2892e1bf512f2a485 (diff) |
Move HaveKey static function from keystore to rpcwallet where it is used
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index eae5f876ea..bc86665782 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -52,6 +52,14 @@ static inline bool GetAvoidReuseFlag(CWallet * const pwallet, const UniValue& pa return avoid_reuse; } +/** Checks if a CKey is in the given CWallet compressed or otherwise*/ +bool HaveKey(const CWallet& wallet, const CKey& key) +{ + CKey key2; + key2.Set(key.begin(), key.end(), !key.IsCompressed()); + return wallet.HaveKey(key.GetPubKey().GetID()) || wallet.HaveKey(key2.GetPubKey().GetID()); +} + bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest& request, std::string& wallet_name) { if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) { |