diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2018-04-18 13:46:11 +0100 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2018-04-18 22:07:58 +0100 |
commit | 3c058fdcc8a71d17296973cb7f09e44a310df22e (patch) | |
tree | 8897fab95f0c2b94503305bef537cf412642ac18 /src | |
parent | 373aee26c3df233f4e0a7e806f45ac7cb5aab1e6 (diff) |
wallet: Add HasWallets
Diffstat (limited to 'src')
-rw-r--r-- | src/rpc/misc.cpp | 2 | ||||
-rw-r--r-- | src/wallet/rpcwallet.cpp | 2 | ||||
-rw-r--r-- | src/wallet/wallet.cpp | 5 | ||||
-rw-r--r-- | src/wallet/wallet.h | 1 |
4 files changed, 8 insertions, 2 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index ba3ea70557..6754407dbd 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -69,7 +69,7 @@ UniValue validateaddress(const JSONRPCRequest& request) { #ifdef ENABLE_WALLET - if (!GetWallets().empty() && IsDeprecatedRPCEnabled("validateaddress")) { + if (HasWallets() && IsDeprecatedRPCEnabled("validateaddress")) { ret.pushKVs(getaddressinfo(request)); } #endif diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 9875a2697d..9b5fb0b062 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -66,7 +66,7 @@ bool EnsureWalletIsAvailable(CWallet * const pwallet, bool avoidException) { if (pwallet) return true; if (avoidException) return false; - if (GetWallets().empty()) { + if (!HasWallets()) { // Note: It isn't currently possible to trigger this error because // 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 diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index fcc4cfb1fa..8c392434fc 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -54,6 +54,11 @@ bool RemoveWallet(CWallet* wallet) return true; } +bool HasWallets() +{ + return !vpwallets.empty(); +} + std::vector<CWallet*> GetWallets() { return vpwallets; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 67f0b3adb7..dd165de825 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -34,6 +34,7 @@ bool AddWallet(CWallet* wallet); bool RemoveWallet(CWallet* wallet); +bool HasWallets(); std::vector<CWallet*> GetWallets(); CWallet* GetWallet(const std::string& name); |