Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 3,466 Lines • ▼ Show 20 Lines | |||||
bool CWallet::GetNewDestination(const OutputType type, const std::string label, | bool CWallet::GetNewDestination(const OutputType type, const std::string label, | ||||
CTxDestination &dest, std::string &error) { | CTxDestination &dest, std::string &error) { | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
error.clear(); | error.clear(); | ||||
bool result = false; | bool result = false; | ||||
auto spk_man = m_spk_man.get(); | auto spk_man = m_spk_man.get(); | ||||
if (spk_man) { | if (spk_man) { | ||||
spk_man->TopUp(); | |||||
result = spk_man->GetNewDestination(type, dest, error); | result = spk_man->GetNewDestination(type, dest, error); | ||||
} | } | ||||
if (result) { | if (result) { | ||||
SetAddressBook(dest, label, "receive"); | SetAddressBook(dest, label, "receive"); | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
bool CWallet::GetNewChangeDestination(const OutputType type, | bool CWallet::GetNewChangeDestination(const OutputType type, | ||||
CTxDestination &dest, | CTxDestination &dest, | ||||
std::string &error) { | std::string &error) { | ||||
error.clear(); | error.clear(); | ||||
m_spk_man->TopUp(); | |||||
ReserveDestination reservedest(this, type); | ReserveDestination reservedest(this, type); | ||||
if (!reservedest.GetReservedDestination(dest, true)) { | if (!reservedest.GetReservedDestination(dest, true)) { | ||||
error = "Error: Keypool ran out, please call keypoolrefill first"; | error = "Error: Keypool ran out, please call keypoolrefill first"; | ||||
return false; | return false; | ||||
} | } | ||||
reservedest.KeepDestination(); | reservedest.KeepDestination(); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | |||||
bool ReserveDestination::GetReservedDestination(CTxDestination &dest, | bool ReserveDestination::GetReservedDestination(CTxDestination &dest, | ||||
bool internal) { | bool internal) { | ||||
m_spk_man = pwallet->GetLegacyScriptPubKeyMan(); | m_spk_man = pwallet->GetLegacyScriptPubKeyMan(); | ||||
if (!m_spk_man) { | if (!m_spk_man) { | ||||
return false; | return false; | ||||
} | } | ||||
if (nIndex == -1) { | if (nIndex == -1) { | ||||
m_spk_man->TopUp(); | |||||
CKeyPool keypool; | CKeyPool keypool; | ||||
if (!m_spk_man->GetReservedDestination(type, internal, address, nIndex, | if (!m_spk_man->GetReservedDestination(type, internal, address, nIndex, | ||||
keypool)) { | keypool)) { | ||||
return false; | return false; | ||||
} | } | ||||
fInternal = keypool.fInternal; | fInternal = keypool.fInternal; | ||||
} | } | ||||
dest = address; | dest = address; | ||||
▲ Show 20 Lines • Show All 847 Lines • Show Last 20 Lines |