aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2017-04-19 13:11:16 -0400
committerMatt Corallo <git@bluematt.me>2017-07-14 21:25:24 -0400
commit28301b9780b05b1d80767835987da1317ce4200a (patch)
tree729657f7c3e4e329281b15fccb2b6cabf42ba212
parent4a3fc35629a2820cecd15898f112fa730e5adcec (diff)
Meet code style on lines changed in the previous commit
-rw-r--r--src/wallet/wallet.cpp24
1 files 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<int64_t>& 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();
}