Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/scriptpubkeyman.cpp
Show All 10 Lines | |||||
#include <util/translation.h> | #include <util/translation.h> | ||||
#include <wallet/scriptpubkeyman.h> | #include <wallet/scriptpubkeyman.h> | ||||
#include <wallet/wallet.h> | #include <wallet/wallet.h> | ||||
bool LegacyScriptPubKeyMan::GetNewDestination(const OutputType type, | bool LegacyScriptPubKeyMan::GetNewDestination(const OutputType type, | ||||
CTxDestination &dest, | CTxDestination &dest, | ||||
std::string &error) { | std::string &error) { | ||||
error.clear(); | error.clear(); | ||||
TopUp(); | |||||
// Generate a new key that is added to wallet | // Generate a new key that is added to wallet | ||||
CPubKey new_key; | CPubKey new_key; | ||||
if (!GetKeyFromPool(new_key, type)) { | if (!GetKeyFromPool(new_key, type)) { | ||||
error = "Error: Keypool ran out, please call keypoolrefill first"; | error = "Error: Keypool ran out, please call keypoolrefill first"; | ||||
return false; | return false; | ||||
} | } | ||||
LearnRelatedScripts(new_key, type); | LearnRelatedScripts(new_key, type); | ||||
▲ Show 20 Lines • Show All 1,118 Lines • ▼ Show 20 Lines | |||||
bool LegacyScriptPubKeyMan::ReserveKeyFromKeyPool(int64_t &nIndex, | bool LegacyScriptPubKeyMan::ReserveKeyFromKeyPool(int64_t &nIndex, | ||||
CKeyPool &keypool, | CKeyPool &keypool, | ||||
bool fRequestedInternal) { | bool fRequestedInternal) { | ||||
nIndex = -1; | nIndex = -1; | ||||
keypool.vchPubKey = CPubKey(); | keypool.vchPubKey = CPubKey(); | ||||
{ | { | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
TopUp(); | |||||
bool fReturningInternal = fRequestedInternal; | bool fReturningInternal = fRequestedInternal; | ||||
fReturningInternal &= | fReturningInternal &= | ||||
(IsHDEnabled() && m_storage.CanSupportFeature(FEATURE_HD_SPLIT)) || | (IsHDEnabled() && m_storage.CanSupportFeature(FEATURE_HD_SPLIT)) || | ||||
m_storage.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS); | m_storage.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS); | ||||
bool use_split_keypool = set_pre_split_keypool.empty(); | bool use_split_keypool = set_pre_split_keypool.empty(); | ||||
std::set<int64_t> &setKeyPool = | std::set<int64_t> &setKeyPool = | ||||
use_split_keypool | use_split_keypool | ||||
? (fReturningInternal ? setInternalKeyPool : setExternalKeyPool) | ? (fReturningInternal ? setInternalKeyPool : setExternalKeyPool) | ||||
▲ Show 20 Lines • Show All 272 Lines • Show Last 20 Lines |