diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -56,8 +56,14 @@ } bool EnsureWalletIsAvailable(CWallet *const pwallet, bool avoidException) { - if (pwallet) return true; - if (avoidException) return false; + if (pwallet) { + return true; + } + + if (avoidException) { + return false; + } + if (::vpwallets.empty()) { // Note: It isn't currently possible to trigger this error because // wallet RPC methods aren't registered unless a wallet is loaded. But @@ -68,6 +74,7 @@ "method is disabled because " "no wallet is loaded)"); } + throw JSONRPCError(RPC_WALLET_NOT_SPECIFIED, "Wallet file not specified (must request wallet RPC " "through /wallet/ uri-path).");