Currently, unloadwallet
RPC call fails with a JSON parsing error when no wallet_name
argument is provided. This behavior is misleading because the error originates from a low-level JSON type mismatch, rather than clearly indicating that the wallet name or RPC endpoint (-rpcwallet=...
) is missing. Also, found out that the issue was noticed during its implementation but never addressed.
In addition, I’ve verified all RPC commands calls finding that getdescriptoractivity
had the same problem, but related to the array input types (blockhashes & descriptors), so I’ve corrected that RPC as well. For consistency I’ve added the missing logging info for each test case in test/functional/rpc_getdescriptoractivity.py
in preparation for the new test.
-Before
0./build/bin/bitcoin-cli -regtest -datadir=/tmp/btc unloadwallet
1error code: -3
2error message:
3JSON value of type number is not of expected type string
0./build/bin/bitcoin-cli -regtest -datadir=/tmp/btc getdescriptoractivity
1error code: -3
2error message:
3JSON value of type null is not of expected type array
0./build/bin/bitcoin-cli -regtest -datadir=/tmp/btc getdescriptoractivity '[]'
1error code: -3
2error message:
3JSON value of type null is not of expected type array
-After
0./build/bin/bitcoin-cli -regtest -datadir=/tmp/btc unloadwallet
1error code: -8
2error message:
3Either the RPC endpoint wallet or the wallet name parameter must be provided
0./build/bin/bitcoin-cli -regtest -datadir=/tmp/btc getdescriptoractivity
1error code: -1
2error message:
3getdescriptoractivity ["blockhash",...] [scanobjects,...] ( include_mempool )
4
5Get spend and receive activity associated with a set of descriptors for a set of blocks. This command pairs well with the `relevant_blocks` output of `scanblocks()`.
6This call may take several minutes. If you encounter timeouts, try specifying no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
7
8Arguments:
91. blockhashes (json array, required) The list of blockhashes to examine for activity. Order doesn't matter. Must be along main chain or an error is thrown.
10
11 [
12 "blockhash", (string) A valid blockhash
13 ...
14 ]
152. scanobjects (json array, required) Array of scan objects. Every scan object is either a string descriptor or an object:
16 [
17 "descriptor", (string) An output descriptor
18 { (json object) An object with output descriptor and metadata
19 "desc": "str", (string, required) An output descriptor
20 "range": n or [n,n], (numeric or array, optional, default=1000) The range of HD chain indexes to explore (either end or [begin,end])
21 },
22 ...
23 ]
243. include_mempool (boolean, optional, default=true) Whether to include unconfirmed activity
25
26...
0./build/bin/bitcoin-cli -regtest -datadir=/tmp/btc getdescriptoractivity '[]'
1error code: -1
2error message:
3getdescriptoractivity ["blockhash",...] [scanobjects,...] ( include_mempool )
4
5...