aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-06-18 15:49:02 -0400
committerAndrew Chow <achow101-github@achow101.com>2019-07-09 16:43:10 -0400
commit8e7f930828a9f8f9be1c90ff45e3fdfef1980eaf (patch)
tree2bb460aa84c7d489e68364fa16776a9785ebb383 /src/wallet/wallet.cpp
parent33d13edd2bda0af90660e275ea4fa96ca9896f2a (diff)
downloadbitcoin-8e7f930828a9f8f9be1c90ff45e3fdfef1980eaf.tar.xz
Add GetNewChangeDestination for getting new change Destinations
Adds a GetNewChangeDestination that has the same objective as GetNewDestination
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 4f632266b3..108f4d6795 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3531,6 +3531,23 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label,
return true;
}
+bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& dest, std::string& error)
+{
+ error.clear();
+ if (!IsLocked()) {
+ TopUpKeyPool();
+ }
+
+ ReserveDestination reservedest(this);
+ if (!reservedest.GetReservedDestination(type, dest, true)) {
+ error = "Error: Keypool ran out, please call keypoolrefill first";
+ return false;
+ }
+
+ reservedest.KeepDestination();
+ return true;
+}
+
static int64_t GetOldestKeyTimeInPool(const std::set<int64_t>& setKeyPool, WalletBatch& batch) {
if (setKeyPool.empty()) {
return GetTime();