Merge #16361: Remove redundant pre-TopUpKeypool check

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

Pull request description:

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

ACKs for top commit:
  achow101:
    ACK 96b6dd468a 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
commit ff0aad8a40
No known key found for this signature in database
GPG Key ID: D2EA4850E7528B25

View File

@ -3414,8 +3414,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;
@ -3476,7 +3475,6 @@ bool CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool, bool fRe
{
LOCK(cs_wallet);
if (!IsLocked())
TopUpKeyPool();
bool fReturningInternal = fRequestedInternal;
@ -3568,9 +3566,8 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label,
{
LOCK(cs_wallet);
error.clear();
if (!IsLocked()) {
TopUpKeyPool();
}
// Generate a new key that is added to wallet
CPubKey new_key;
@ -3588,9 +3585,8 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label,
bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& dest, std::string& error)
{
error.clear();
if (!IsLocked()) {
TopUpKeyPool();
}
ReserveDestination reservedest(this);
if (!reservedest.GetReservedDestination(type, dest, true)) {