Skip to content

Commit ff0aad8

Browse files
author
MarcoFalke
committed
Merge #16361: Remove redundant pre-TopUpKeypool check
96b6dd4 Remove redundant pre-TopUpKeypool checks (Gregory Sanders) Pull request description: TopUpKeypool already has a quick check for `IsLocked()` ACKs for top commit: achow101: ACK 96b6dd4 Reviewed the diff and checked that the `if (!IsLocked()) TopUpKeypool()` pattern is changed everywhere. Tree-SHA512: 36f5ae1be611404656ac855763e569fd3b5e932db8170f39ebda74300aa02062774b2c28ce6cf00f2ccc0e3550de58df36efa9097e24f0a51f2809b8a489c95a
2 parents 6c1e45c + 96b6dd4 commit ff0aad8

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)