Skip to content

Commit ccbf7ae

Browse files
committed
test: Wallet methods are disabled when no wallet is loaded
1 parent 4940a20 commit ccbf7ae

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ bool EnsureWalletIsAvailable(CWallet * const pwallet, bool avoidException)
7575
if (pwallet) return true;
7676
if (avoidException) return false;
7777
if (!HasWallets()) {
78-
// Note: It isn't currently possible to trigger this error because
79-
// wallet RPC methods aren't registered unless a wallet is loaded. But
80-
// this error is being kept as a precaution, because it's possible in
81-
// the future that wallet RPC methods might get or remain registered
82-
// when no wallets are loaded.
8378
throw JSONRPCError(
8479
RPC_METHOD_NOT_FOUND, "Method not found (wallet method is disabled because no wallet is loaded)");
8580
}

test/functional/wallet_multiwallet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def run_test(self):
254254
for wallet_name in self.nodes[0].listwallets():
255255
self.nodes[0].unloadwallet(wallet_name)
256256
assert_equal(self.nodes[0].listwallets(), [])
257+
assert_raises_rpc_error(-32601, "Method not found (wallet method is disabled because no wallet is loaded)", self.nodes[0].getwalletinfo)
257258

258259
if __name__ == '__main__':
259260
MultiWalletTest().main()

0 commit comments

Comments
 (0)