Skip to content

Commit 392c6f4

Browse files
author
MarcoFalke
committed
Merge #20101: rpc: change no wallet loaded message to be clearer
907f142 rpc: change no wallet loaded message to be clearer (Andrew Chow) Pull request description: 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. ACKs for top commit: MarcoFalke: review ACK 907f142 kristapsk: ACK 907f142. In addition to standard tests, just in case tested that this doesn't break anything with JoinMarket. meshcollider: utACK 907f142 Tree-SHA512: 4b413e6ab5430ec75a79de9db6583f2f3f38ccdf71aa373d8386a56e64f07f92200c8107c8c82c92c7c431d739615977c208b771a24c5960fa8676789b5497a2
2 parents b337bd7 + 907f142 commit 392c6f4

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)