diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-07-10 13:31:05 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-07-10 13:31:24 -0400 |
commit | ff0aad8a40a01da3f9031c7c583cb489cc5c8c57 (patch) | |
tree | e4f11358a8c71f4c84e37484515f7b7806e4a05d | |
parent | 6c1e45c4c41676f80ac6fb8d48cfbcf839593f19 (diff) | |
parent | 96b6dd468a4cb6077d1a2267d620d99d39aac7d0 (diff) |
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
-rw-r--r-- | src/wallet/wallet.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a9bd1e3164..5fb883d48b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -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,8 +3475,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); @@ -3568,9 +3566,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; @@ -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(); - } + + TopUpKeyPool(); ReserveDestination reservedest(this); if (!reservedest.GetReservedDestination(type, dest, true)) { |