From 28301b9780b05b1d80767835987da1317ce4200a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 19 Apr 2017 13:11:16 -0400 Subject: [PATCH] Meet code style on lines changed in the previous commit --- src/wallet/wallet.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index cc4d99d301..61d9752460 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3081,11 +3081,15 @@ bool CWallet::NewKeyPool() { LOCK(cs_wallet); CWalletDB walletdb(*dbw); - for (int64_t nIndex : setInternalKeyPool) + + for (int64_t nIndex : setInternalKeyPool) { walletdb.ErasePool(nIndex); + } setInternalKeyPool.clear(); - BOOST_FOREACH(int64_t nIndex, setExternalKeyPool) + + for (int64_t nIndex : setExternalKeyPool) { walletdb.ErasePool(nIndex); + } setExternalKeyPool.clear(); if (!TopUpKeyPool()) { @@ -3132,12 +3136,16 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize) for (int64_t i = missingInternal + missingExternal; i--;) { int64_t nEnd = 1; - if (i < missingInternal) + if (i < missingInternal) { internal = true; - if (!setInternalKeyPool.empty()) + } + + if (!setInternalKeyPool.empty()) { nEnd = *(--setInternalKeyPool.end()) + 1; - if (!setExternalKeyPool.empty()) + } + if (!setExternalKeyPool.empty()) { nEnd = std::max(nEnd, *(--setExternalKeyPool.end()) + 1); + } if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey(internal), internal))) throw std::runtime_error(std::string(__func__) + ": writing generated key failed"); @@ -3238,8 +3246,9 @@ static int64_t GetOldestKeyTimeInPool(const std::set& setKeyPool, CWall CKeyPool keypool; int64_t nIndex = *(setKeyPool.begin()); - if (!walletdb.ReadPool(nIndex, keypool)) + if (!walletdb.ReadPool(nIndex, keypool)) { throw std::runtime_error(std::string(__func__) + ": read oldest key in keypool failed"); + } assert(keypool.vchPubKey.IsValid()); return keypool.nTime; } @@ -3434,8 +3443,9 @@ void CReserveKey::KeepKey() void CReserveKey::ReturnKey() { - if (nIndex != -1) + if (nIndex != -1) { pwallet->ReturnKey(nIndex, fInternal); + } nIndex = -1; vchPubKey = CPubKey(); }