diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 09a436e1167..f5125f22db6 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -538,8 +538,10 @@ static void GetWalletBalances(UniValue& result) */ static UniValue GetNewAddress() { + Optional wallet_name{}; + if (gArgs.IsArgSet("-rpcwallet")) wallet_name = gArgs.GetArg("-rpcwallet", ""); std::unique_ptr rh{MakeUnique()}; - return ConnectAndCallRPC(rh.get(), "getnewaddress", /* args=*/{}); + return ConnectAndCallRPC(rh.get(), "getnewaddress", /* args=*/{}, wallet_name); } /**