From ccbf7ae7496fd13b4147aa13d7408712bd90c614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Tue, 12 Jun 2018 15:30:32 +0100 Subject: [PATCH] test: Wallet methods are disabled when no wallet is loaded --- src/wallet/rpcwallet.cpp | 5 ----- test/functional/wallet_multiwallet.py | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index daef8473f1..5e9eb2b26a 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -75,11 +75,6 @@ bool EnsureWalletIsAvailable(CWallet * const pwallet, bool avoidException) if (pwallet) return true; if (avoidException) return false; 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 - // the future that wallet RPC methods might get or remain registered - // when no wallets are loaded. throw JSONRPCError( RPC_METHOD_NOT_FOUND, "Method not found (wallet method is disabled because no wallet is loaded)"); } diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py index 7f739a1316..8d15ef661b 100755 --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -254,6 +254,7 @@ class MultiWalletTest(BitcoinTestFramework): for wallet_name in self.nodes[0].listwallets(): self.nodes[0].unloadwallet(wallet_name) assert_equal(self.nodes[0].listwallets(), []) + assert_raises_rpc_error(-32601, "Method not found (wallet method is disabled because no wallet is loaded)", self.nodes[0].getwalletinfo) if __name__ == '__main__': MultiWalletTest().main()