diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-06-18 15:49:02 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2019-07-09 16:43:10 -0400 |
commit | 8e7f930828a9f8f9be1c90ff45e3fdfef1980eaf (patch) | |
tree | 2bb460aa84c7d489e68364fa16776a9785ebb383 /src/wallet/rpcwallet.cpp | |
parent | 33d13edd2bda0af90660e275ea4fa96ca9896f2a (diff) |
Add GetNewChangeDestination for getting new change Destinations
Adds a GetNewChangeDestination that has the same objective as GetNewDestination
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 40ad69f61c..23900cbd67 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -226,10 +226,6 @@ static UniValue getrawchangeaddress(const JSONRPCRequest& request) throw JSONRPCError(RPC_WALLET_ERROR, "Error: This wallet has no available keys"); } - if (!pwallet->IsLocked()) { - pwallet->TopUpKeyPool(); - } - OutputType output_type = pwallet->m_default_change_type != OutputType::CHANGE_AUTO ? pwallet->m_default_change_type : pwallet->m_default_address_type; if (!request.params[0].isNull()) { if (!ParseOutputType(request.params[0].get_str(), output_type)) { @@ -237,12 +233,11 @@ static UniValue getrawchangeaddress(const JSONRPCRequest& request) } } - ReserveDestination reservedest(pwallet); CTxDestination dest; - if (!reservedest.GetReservedDestination(output_type, dest, true)) - throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first"); - - reservedest.KeepDestination(); + std::string error; + if (!pwallet->GetNewChangeDestination(output_type, dest, error)) { + throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, error); + } return EncodeDestination(dest); } |