Skip to content

Commit 96b6dd4

Browse files
committed
Remove redundant pre-TopUpKeypool checks
1 parent 6c1e45c commit 96b6dd4

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/wallet/wallet.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,8 +3414,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
34143414
{
34153415
LOCK(cs_wallet);
34163416

3417-
if (IsLocked())
3418-
return false;
3417+
if (IsLocked()) return false;
34193418

34203419
// Top up key pool
34213420
unsigned int nTargetSize;
@@ -3476,8 +3475,7 @@ bool CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool, bool fRe
34763475
{
34773476
LOCK(cs_wallet);
34783477

3479-
if (!IsLocked())
3480-
TopUpKeyPool();
3478+
TopUpKeyPool();
34813479

34823480
bool fReturningInternal = fRequestedInternal;
34833481
fReturningInternal &= (IsHDEnabled() && CanSupportFeature(FEATURE_HD_SPLIT)) || IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
@@ -3568,9 +3566,8 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label,
35683566
{
35693567
LOCK(cs_wallet);
35703568
error.clear();
3571-
if (!IsLocked()) {
3572-
TopUpKeyPool();
3573-
}
3569+
3570+
TopUpKeyPool();
35743571

35753572
// Generate a new key that is added to wallet
35763573
CPubKey new_key;
@@ -3588,9 +3585,8 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label,
35883585
bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& dest, std::string& error)
35893586
{
35903587
error.clear();
3591-
if (!IsLocked()) {
3592-
TopUpKeyPool();
3593-
}
3588+
3589+
TopUpKeyPool();
35943590

35953591
ReserveDestination reservedest(this);
35963592
if (!reservedest.GetReservedDestination(type, dest, true)) {

0 commit comments

Comments
 (0)