Allow specifying the wallet_name param to unloadwallet on RPC wallet endpoints, so long as it matches the endpoint wallet.
RPC/Wallet: unloadwallet: Allow specifying wallet_name param matching RPC endpoint wallet #20448
pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:unloadwallet_namematch changing 2 files +10 −5-
luke-jr commented at 7:15 PM on November 21, 2020: member
-
promag commented at 7:22 PM on November 21, 2020: member
FWIW I thought about disallowing
wallet_namewhen using a wallet endpoint. -
luke-jr commented at 7:25 PM on November 21, 2020: member
That's what the current code does (and the first commit of this PR documents).
- DrahtBot added the label RPC/REST/ZMQ on Nov 21, 2020
- DrahtBot added the label Wallet on Nov 21, 2020
- MarcoFalke added the label Needs backport (0.21) on Nov 23, 2020
- MarcoFalke removed the label Needs backport (0.21) on Nov 23, 2020
-
MarcoFalke commented at 6:55 AM on November 23, 2020: member
would be easier to review and backport if the commit was a separate pull
-
in test/functional/wallet_multiwallet.py:358 in 2e9ada5183 outdated
354 | @@ -355,12 +355,18 @@ def wallet_file(name): 355 | assert_raises_rpc_error(-1, "JSON value is not a string as expected", self.nodes[0].unloadwallet) 356 | assert_raises_rpc_error(-18, "Requested wallet does not exist or is not loaded", self.nodes[0].unloadwallet, "dummy") 357 | assert_raises_rpc_error(-18, "Requested wallet does not exist or is not loaded", node.get_wallet_rpc("dummy").unloadwallet) 358 | - assert_raises_rpc_error(-8, "Cannot unload the requested wallet", w1.unloadwallet, "w2"), 359 | + assert_raises_rpc_error(-8, "RPC request wallet and wallet_name parameter specify different wallets", w1.unloadwallet, "w2"),
jonatack commented at 7:49 AM on November 23, 2020:81162ec41e5ee2ce0 For the first commit, suggest testing with the same wallet name:
- assert_raises_rpc_error(-8, "Both the RPC request wallet and wallet_name parameter were provided (only one allowed)", w1.unloadwallet, "w2"), + assert_raises_rpc_error(-8, "Both the RPC request wallet and wallet_name parameter were provided (only one allowed)", w1.unloadwallet, w1.getwalletinfo()["walletname"]),in src/wallet/rpcwallet.cpp:2809 in 2e9ada5183 outdated
2805 | @@ -2806,8 +2806,8 @@ static RPCHelpMan unloadwallet() 2806 | { 2807 | std::string wallet_name; 2808 | if (GetWalletNameFromJSONRPCRequest(request, wallet_name)) { 2809 | - if (!request.params[0].isNull()) { 2810 | - throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot unload the requested wallet"); 2811 | + if (!(request.params[0].isNull() || request.params[0].get_str() == wallet_name)) {
jonatack commented at 8:09 AM on November 23, 2020:2e9ada51830236a027371a48697b96 nit, would find this clearer
if (!request.params[0].isNull() && request.params[0].get_str() != wallet_name) {
luke-jr commented at 1:53 PM on November 23, 2020:That's strictly less clear (it relies on implicit precedence order)
jonatack commented at 8:10 AM on November 23, 2020: memberApproach ACK
luke-jr commented at 1:51 PM on November 23, 2020: member@MarcoFalke Should I interpret that as a NACK to backporting the 2nd commit? (I said at least the first...)
MarcoFalke commented at 2:00 PM on November 23, 2020: memberYes, feature freeze was a month ago
DrahtBot commented at 9:55 PM on November 23, 2020: member<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
No conflicts as of last run.
RPC/Wallet: unloadwallet: Allow specifying wallet_name param matching RPC endpoint 89bdad5b25MarcoFalke referenced this in commit 3a32b62fa7 on Nov 24, 2020DrahtBot added the label Needs rebase on Nov 24, 2020sidhujag referenced this in commit 94ee716b40 on Nov 24, 2020luke-jr force-pushed on Nov 24, 2020luke-jr renamed this:RPC/Wallet: unloadwallet: Allow specifying wallet_name param matching RPC request, and document behaviour
RPC/Wallet: unloadwallet: Allow specifying wallet_name param matching RPC request
on Nov 24, 2020luke-jr renamed this:RPC/Wallet: unloadwallet: Allow specifying wallet_name param matching RPC request
RPC/Wallet: unloadwallet: Allow specifying wallet_name param matching RPC endpoint wallet
on Nov 24, 2020luke-jr commented at 7:07 PM on November 24, 2020: memberrebased
DrahtBot removed the label Needs rebase on Nov 24, 2020jonatack commented at 8:10 PM on November 27, 2020: memberACK 89bdad5b25ae4ac03a486f729a5b58ae6f21946d
MarcoFalke commented at 9:13 AM on November 28, 2020: memberreview ACK 89bdad5b25ae4ac03a486f729a5b58ae6f21946d
MarcoFalke merged this on Nov 28, 2020MarcoFalke closed this on Nov 28, 2020sidhujag referenced this in commit 360bf12418 on Nov 28, 2020MarcoFalke locked this on Feb 15, 2022
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC
More mirrored repositories can be found on mirror.b10c.me