@@ -3081,11 +3081,15 @@ bool CWallet::NewKeyPool()
30813081 {
30823082 LOCK (cs_wallet);
30833083 CWalletDB walletdb (*dbw);
3084- for (int64_t nIndex : setInternalKeyPool)
3084+
3085+ for (int64_t nIndex : setInternalKeyPool) {
30853086 walletdb.ErasePool (nIndex);
3087+ }
30863088 setInternalKeyPool.clear ();
3087- BOOST_FOREACH (int64_t nIndex, setExternalKeyPool)
3089+
3090+ for (int64_t nIndex : setExternalKeyPool) {
30883091 walletdb.ErasePool (nIndex);
3092+ }
30893093 setExternalKeyPool.clear ();
30903094
30913095 if (!TopUpKeyPool ()) {
@@ -3132,12 +3136,16 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
31323136 for (int64_t i = missingInternal + missingExternal; i--;)
31333137 {
31343138 int64_t nEnd = 1 ;
3135- if (i < missingInternal)
3139+ if (i < missingInternal) {
31363140 internal = true ;
3137- if (!setInternalKeyPool.empty ())
3141+ }
3142+
3143+ if (!setInternalKeyPool.empty ()) {
31383144 nEnd = *(--setInternalKeyPool.end ()) + 1 ;
3139- if (!setExternalKeyPool.empty ())
3145+ }
3146+ if (!setExternalKeyPool.empty ()) {
31403147 nEnd = std::max (nEnd, *(--setExternalKeyPool.end ()) + 1 );
3148+ }
31413149
31423150 if (!walletdb.WritePool (nEnd, CKeyPool (GenerateNewKey (internal), internal)))
31433151 throw std::runtime_error (std::string (__func__) + " : writing generated key failed" );
@@ -3238,8 +3246,9 @@ static int64_t GetOldestKeyTimeInPool(const std::set<int64_t>& setKeyPool, CWall
32383246
32393247 CKeyPool keypool;
32403248 int64_t nIndex = *(setKeyPool.begin ());
3241- if (!walletdb.ReadPool (nIndex, keypool))
3249+ if (!walletdb.ReadPool (nIndex, keypool)) {
32423250 throw std::runtime_error (std::string (__func__) + " : read oldest key in keypool failed" );
3251+ }
32433252 assert (keypool.vchPubKey .IsValid ());
32443253 return keypool.nTime ;
32453254}
@@ -3434,8 +3443,9 @@ void CReserveKey::KeepKey()
34343443
34353444void CReserveKey::ReturnKey ()
34363445{
3437- if (nIndex != -1 )
3446+ if (nIndex != -1 ) {
34383447 pwallet->ReturnKey (nIndex, fInternal );
3448+ }
34393449 nIndex = -1 ;
34403450 vchPubKey = CPubKey ();
34413451}
0 commit comments