Merge #19261: refactor: Drop ::HasWallets()

ccf1f6ea24905876f35e685204cb2293cf083e97 refactor: Drop ::HasWallets() (João Barbosa)

Pull request description:

  Minor follow-up of #19250. The global `HasWallets()` is used only once and at the call site there's already a way to know if any wallet is loaded.

ACKs for top commit:
  MarcoFalke:
    ACK ccf1f6ea24905876f35e685204cb2293cf083e97
  hebasto:
    ACK ccf1f6ea24905876f35e685204cb2293cf083e97, I have reviewed the changes and they look OK, I agree they can be merged.

Tree-SHA512: fb902c045cbd331eaf71716c04734520f2ce7f2b317db510c4ce140162bbc683327b5a40ac860f6cde5add37e069065274d39dfa147fac2091eedec505f2f7eb
This commit is contained in:
MarcoFalke 2020-06-13 10:30:28 -04:00
commit eac65d99dd
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548
3 changed files with 1 additions and 8 deletions

View File

@ -106,7 +106,7 @@ std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& reques
return wallets[0];
}
if (!HasWallets()) {
if (wallets.empty()) {
throw JSONRPCError(
RPC_METHOD_NOT_FOUND, "Method not found (wallet method is disabled because no wallet is loaded)");
}

View File

@ -77,12 +77,6 @@ bool RemoveWallet(const std::shared_ptr<CWallet>& wallet)
return true;
}
bool HasWallets()
{
LOCK(cs_wallets);
return !vpwallets.empty();
}
std::vector<std::shared_ptr<CWallet>> GetWallets()
{
LOCK(cs_wallets);

View File

@ -51,7 +51,6 @@ void UnloadWallet(std::shared_ptr<CWallet>&& wallet);
bool AddWallet(const std::shared_ptr<CWallet>& wallet);
bool RemoveWallet(const std::shared_ptr<CWallet>& wallet);
bool HasWallets();
std::vector<std::shared_ptr<CWallet>> GetWallets();
std::shared_ptr<CWallet> GetWallet(const std::string& name);
std::shared_ptr<CWallet> LoadWallet(interfaces::Chain& chain, const WalletLocation& location, bilingual_str& error, std::vector<bilingual_str>& warnings);