diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -959,9 +959,14 @@ * @returns getnewaddress response as a UniValue object. */ static UniValue GetNewAddress() { + std::optional wallet_name{}; + if (gArgs.IsArgSet("-rpcwallet")) { + wallet_name = gArgs.GetArg("-rpcwallet", ""); + } std::unique_ptr rh{ std::make_unique()}; - return ConnectAndCallRPC(rh.get(), "getnewaddress", /* args=*/{}); + return ConnectAndCallRPC(rh.get(), "getnewaddress", /* args=*/{}, + wallet_name); } /**