Skip to content

Commit 907f142

Browse files
committed
rpc: change no wallet loaded message to be clearer
Changes the no wallet is loaded rpc error message to be clearer that no wallet is loaded and how the user can load or create a wallet. Also changes the error code from METHOD_NOT_FOUND to RPC_WALLET_NOT_FOUND as that makes more sense.
1 parent 283a73d commit 907f142

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& reques
112112

113113
if (wallets.empty()) {
114114
throw JSONRPCError(
115-
RPC_METHOD_NOT_FOUND, "Method not found (wallet method is disabled because no wallet is loaded)");
115+
RPC_WALLET_NOT_FOUND, "No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created)");
116116
}
117117
throw JSONRPCError(RPC_WALLET_NOT_SPECIFIED,
118118
"Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).");

test/functional/wallet_multiwallet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def wallet_file(name):
204204

205205
self.restart_node(0, ['-nowallet'])
206206
assert_equal(node.listwallets(), [])
207-
assert_raises_rpc_error(-32601, "Method not found", node.getwalletinfo)
207+
assert_raises_rpc_error(-18, "No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created)", node.getwalletinfo)
208208

209209
self.log.info("Load first wallet")
210210
loadwallet_name = node.loadwallet(wallet_names[0])
@@ -316,7 +316,7 @@ def wallet_file(name):
316316
for wallet_name in self.nodes[0].listwallets():
317317
self.nodes[0].unloadwallet(wallet_name)
318318
assert_equal(self.nodes[0].listwallets(), [])
319-
assert_raises_rpc_error(-32601, "Method not found (wallet method is disabled because no wallet is loaded)", self.nodes[0].getwalletinfo)
319+
assert_raises_rpc_error(-18, "No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created)", self.nodes[0].getwalletinfo)
320320

321321
# Successfully load a previously unloaded wallet
322322
self.nodes[0].loadwallet('w1')

0 commit comments

Comments
 (0)