Merge #16361: Remove redundant pre-TopUpKeypool check

96b6dd468a4cb6077d1a2267d620d99d39aac7d0 Remove redundant pre-TopUpKeypool checks (Gregory Sanders)

Pull request description:

  TopUpKeypool already has a quick check for `IsLocked()`

ACKs for top commit:
  achow101:
    ACK 96b6dd468a4cb6077d1a2267d620d99d39aac7d0 Reviewed the diff and checked that the `if (!IsLocked()) TopUpKeypool()` pattern is changed everywhere.

Tree-SHA512: 36f5ae1be611404656ac855763e569fd3b5e932db8170f39ebda74300aa02062774b2c28ce6cf00f2ccc0e3550de58df36efa9097e24f0a51f2809b8a489c95a
This commit is contained in:
MarcoFalke 2019-07-10 13:31:05 -04:00 committed by Munkybooty
parent 35e8922274
commit 0feb04ab6f

View File

@ -4197,8 +4197,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
{
LOCK(cs_wallet);
if (IsLocked(true))
return false;
if (IsLocked(true)) return false;
// Top up key pool
unsigned int nTargetSize;
@ -4267,8 +4266,7 @@ bool CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool, bool fRe
{
LOCK(cs_wallet);
if (!IsLocked(true))
TopUpKeyPool();
TopUpKeyPool();
bool fReturningInternal = IsHDEnabled() && fRequestedInternal;
std::set<int64_t>& setKeyPool = fReturningInternal ? setInternalKeyPool : setExternalKeyPool;