mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Add GetNewChangeDestination for getting new change Destinations
Adds a GetNewChangeDestination that has the same objective as GetNewDestination
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user