Merge ff0aad8a40 into merged_master (Bitcoin PR #16361)

This commit is contained in:
Andrew Poelstra 2020-11-09 03:58:21 +00:00
commit 8a94b6b2cb

View file

@ -4064,8 +4064,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
{
LOCK(cs_wallet);
if (IsLocked())
return false;
if (IsLocked()) return false;
// Top up key pool
unsigned int nTargetSize;
@ -4126,8 +4125,7 @@ bool CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool, bool fRe
{
LOCK(cs_wallet);
if (!IsLocked())
TopUpKeyPool();
TopUpKeyPool();
bool fReturningInternal = fRequestedInternal;
fReturningInternal &= (IsHDEnabled() && CanSupportFeature(FEATURE_HD_SPLIT)) || IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
@ -4229,9 +4227,8 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label,
{
LOCK(cs_wallet);
error.clear();
if (!IsLocked()) {
TopUpKeyPool();
}
TopUpKeyPool();
// Generate a new key that is added to wallet
CPubKey new_key;
@ -4253,9 +4250,8 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label,
bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& dest, std::string& error, bool add_blinding_key)
{
error.clear();
if (!IsLocked()) {
TopUpKeyPool();
}
TopUpKeyPool();
ReserveDestination reservedest(this);
if (!reservedest.GetReservedDestination(type, dest, true)) {