Skip to content

Commit

Permalink
cli: add multiwallet capability to GetNewAddress and -generate
Browse files Browse the repository at this point in the history
Summary:
This is a backport of [[bitcoin/bitcoin#19133 | core#19133]] [8/10]
bitcoin/bitcoin@4b859cf

Depends on D9947

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9948
  • Loading branch information
jonatack authored and PiRK committed Aug 26, 2021
1 parent b1c0b2c commit 27ebcb0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,14 @@ static void GetWalletBalances(UniValue &result) {
* @returns getnewaddress response as a UniValue object.
*/
static UniValue GetNewAddress() {
std::optional<std::string> wallet_name{};
if (gArgs.IsArgSet("-rpcwallet")) {
wallet_name = gArgs.GetArg("-rpcwallet", "");
}
std::unique_ptr<BaseRequestHandler> rh{
std::make_unique<DefaultRequestHandler>()};
return ConnectAndCallRPC(rh.get(), "getnewaddress", /* args=*/{});
return ConnectAndCallRPC(rh.get(), "getnewaddress", /* args=*/{},
wallet_name);
}

/**
Expand Down

0 comments on commit 27ebcb0

Please sign in to comment.