TL;DR: Try 'loadwallet' first before using '-rpcwallet' using full directory path on both commands. Refer below for the commands.
Long "
story" follows:
I've been trying to use the following commands:
bitcoin-cli -testnet listunspent
bitcoin-cli -testnet createwallet XXX
bitcoin-cli -testnet getnewaddress
But they're all returning the same error:
It worked initially for me even if I use a different 'walletdir' in the config file.
But after using '-rpcwallet' once, only the two commands returned with the same error.
The other one:
bitcoin-cli -regtest createwallet xx still worked at my end.
Any thoughts?
Wallets from a different directory like
E:\AppData\testdir\wallet1 just returned with this error:
error code: -18
error message:
Requested wallet does not exist or is not loaded
But it worked (
with full directory path) after using 'loadwallet':
bitcoin-cli -regtest loadwallet E:\AppData\testdir\wallet1
bitcoin-cli -regtest -rpcwallet=E:\AppData\testdir\wallet1 listunspent
And my other test, I have other folders with wallet.dat in the same location as my custom wallet directory, using just that folder's name worked.
Example:
My custom wallet directory is in
E:\AppData\testwalletdirMy other wallet is in
E:\AppData\testwalletdir\wallettest1 | These commands worked:
bitcoin-cli -regtest loadwallet wallettest1
bitcoin-cli -regtest -rpcwallet=wallettest1 getnewaddress
Use 'loadwallet' only once.