mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #20101: rpc: change no wallet loaded message to be clearer
907f142fc7e1d35f443be076367739faf11cc2cc 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 907f142fc7e1d35f443be076367739faf11cc2cc kristapsk: ACK 907f142fc7e1d35f443be076367739faf11cc2cc. In addition to standard tests, just in case tested that this doesn't break anything with JoinMarket. meshcollider: utACK 907f142fc7e1d35f443be076367739faf11cc2cc Tree-SHA512: 4b413e6ab5430ec75a79de9db6583f2f3f38ccdf71aa373d8386a56e64f07f92200c8107c8c82c92c7c431d739615977c208b771a24c5960fa8676789b5497a2
This commit is contained in:
parent
788e3d31b4
commit
b682ce2a79
@ -81,7 +81,7 @@ bool EnsureWalletIsAvailable(CWallet * const pwallet, bool avoidException)
|
|||||||
if (avoidException) return false;
|
if (avoidException) return false;
|
||||||
if (!HasWallets()) {
|
if (!HasWallets()) {
|
||||||
throw JSONRPCError(
|
throw JSONRPCError(
|
||||||
RPC_METHOD_NOT_FOUND, "Method not found (wallet method is disabled because no wallet is loaded)");
|
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)");
|
||||||
}
|
}
|
||||||
throw JSONRPCError(RPC_WALLET_NOT_SPECIFIED,
|
throw JSONRPCError(RPC_WALLET_NOT_SPECIFIED,
|
||||||
"Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).");
|
"Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).");
|
||||||
|
@ -183,7 +183,7 @@ class MultiWalletTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
self.restart_node(0, ['-nowallet'])
|
self.restart_node(0, ['-nowallet'])
|
||||||
assert_equal(node.listwallets(), [])
|
assert_equal(node.listwallets(), [])
|
||||||
assert_raises_rpc_error(-32601, "Method not found", node.getwalletinfo)
|
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)
|
||||||
|
|
||||||
self.log.info("Load first wallet")
|
self.log.info("Load first wallet")
|
||||||
loadwallet_name = node.loadwallet(wallet_names[0])
|
loadwallet_name = node.loadwallet(wallet_names[0])
|
||||||
@ -278,7 +278,7 @@ class MultiWalletTest(BitcoinTestFramework):
|
|||||||
for wallet_name in self.nodes[0].listwallets():
|
for wallet_name in self.nodes[0].listwallets():
|
||||||
self.nodes[0].unloadwallet(wallet_name)
|
self.nodes[0].unloadwallet(wallet_name)
|
||||||
assert_equal(self.nodes[0].listwallets(), [])
|
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)
|
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)
|
||||||
|
|
||||||
# Successfully load a previously unloaded wallet
|
# Successfully load a previously unloaded wallet
|
||||||
self.nodes[0].loadwallet('w1')
|
self.nodes[0].loadwallet('w1')
|
||||||
|
Loading…
Reference in New Issue
Block a user