Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
bool EnsureWalletIsAvailable(CWallet *const pwallet, bool avoidException) { | bool EnsureWalletIsAvailable(CWallet *const pwallet, bool avoidException) { | ||||
if (pwallet) { | if (pwallet) { | ||||
return true; | return true; | ||||
} | } | ||||
if (avoidException) { | if (avoidException) { | ||||
return false; | 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 | ||||
// the future that wallet RPC methods might get or remain registered | // the future that wallet RPC methods might get or remain registered | ||||
// when no wallets are loaded. | // when no wallets are loaded. | ||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (wallet " | throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (wallet " | ||||
"method is disabled because " | "method is disabled because " | ||||
"no wallet is loaded)"); | "no wallet is loaded)"); | ||||
▲ Show 20 Lines • Show All 4,200 Lines • Show Last 20 Lines |