Skip to content

Commit a913e3f

Browse files
committed
Move HaveKey static function from keystore to rpcwallet where it is used
1 parent c7797ec commit a913e3f

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/keystore.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,3 @@ CKeyID GetKeyForDestination(const CBasicKeyStore& store, const CTxDestination& d
196196
}
197197
return CKeyID();
198198
}
199-
200-
bool HaveKey(const CBasicKeyStore& store, const CKey& key)
201-
{
202-
CKey key2;
203-
key2.Set(key.begin(), key.end(), !key.IsCompressed());
204-
return store.HaveKey(key.GetPubKey().GetID()) || store.HaveKey(key2.GetPubKey().GetID());
205-
}

src/keystore.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,4 @@ class CBasicKeyStore : public SigningProvider
5454
/** Return the CKeyID of the key involved in a script (if there is a unique one). */
5555
CKeyID GetKeyForDestination(const CBasicKeyStore& store, const CTxDestination& dest);
5656

57-
/** Checks if a CKey is in the given CBasicKeyStore compressed or otherwise*/
58-
bool HaveKey(const CBasicKeyStore& store, const CKey& key);
59-
6057
#endif // BITCOIN_KEYSTORE_H

src/wallet/rpcwallet.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ static inline bool GetAvoidReuseFlag(CWallet * const pwallet, const UniValue& pa
5252
return avoid_reuse;
5353
}
5454

55+
/** Checks if a CKey is in the given CWallet compressed or otherwise*/
56+
bool HaveKey(const CWallet& wallet, const CKey& key)
57+
{
58+
CKey key2;
59+
key2.Set(key.begin(), key.end(), !key.IsCompressed());
60+
return wallet.HaveKey(key.GetPubKey().GetID()) || wallet.HaveKey(key2.GetPubKey().GetID());
61+
}
62+
5563
bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest& request, std::string& wallet_name)
5664
{
5765
if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) {

0 commit comments

Comments
 (0)