mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
wallet: Add HasWallets
This commit is contained in:
parent
373aee26c3
commit
3c058fdcc8
4 changed files with 8 additions and 2 deletions
|
@ -69,7 +69,7 @@ UniValue validateaddress(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
if (!GetWallets().empty() && IsDeprecatedRPCEnabled("validateaddress")) {
|
if (HasWallets() && IsDeprecatedRPCEnabled("validateaddress")) {
|
||||||
ret.pushKVs(getaddressinfo(request));
|
ret.pushKVs(getaddressinfo(request));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,7 +66,7 @@ bool EnsureWalletIsAvailable(CWallet * const pwallet, bool avoidException)
|
||||||
{
|
{
|
||||||
if (pwallet) return true;
|
if (pwallet) return true;
|
||||||
if (avoidException) return false;
|
if (avoidException) return false;
|
||||||
if (GetWallets().empty()) {
|
if (!HasWallets()) {
|
||||||
// Note: It isn't currently possible to trigger this error because
|
// Note: It isn't currently possible to trigger this error because
|
||||||
// wallet RPC methods aren't registered unless a wallet is loaded. But
|
// wallet RPC methods aren't registered unless a wallet is loaded. But
|
||||||
// this error is being kept as a precaution, because it's possible in
|
// this error is being kept as a precaution, because it's possible in
|
||||||
|
|
|
@ -54,6 +54,11 @@ bool RemoveWallet(CWallet* wallet)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasWallets()
|
||||||
|
{
|
||||||
|
return !vpwallets.empty();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<CWallet*> GetWallets()
|
std::vector<CWallet*> GetWallets()
|
||||||
{
|
{
|
||||||
return vpwallets;
|
return vpwallets;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
bool AddWallet(CWallet* wallet);
|
bool AddWallet(CWallet* wallet);
|
||||||
bool RemoveWallet(CWallet* wallet);
|
bool RemoveWallet(CWallet* wallet);
|
||||||
|
bool HasWallets();
|
||||||
std::vector<CWallet*> GetWallets();
|
std::vector<CWallet*> GetWallets();
|
||||||
CWallet* GetWallet(const std::string& name);
|
CWallet* GetWallet(const std::string& name);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue