diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2016-09-09 08:42:30 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2017-06-06 21:17:09 +0000 |
commit | b124cf04ea47e1eda60bbc26a9690a9715c6b23f (patch) | |
tree | a6efe783bcbcf8b37736d20de0aa365ae352e161 /src/wallet/walletdb.cpp | |
parent | 19b3648bb52d27c3a9674159d71726b73fe532d9 (diff) |
Wallet: Replace pwalletMain with a vector of wallet pointers
Diffstat (limited to 'src/wallet/walletdb.cpp')
-rw-r--r-- | src/wallet/walletdb.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 149d0e0c20..6f5ddece9a 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -760,24 +760,23 @@ void MaybeCompactWalletDB() return; } - CWalletDBWrapper& dbh = pwalletMain->GetDBHandle(); + for (CWalletRef pwallet : vpwallets) { + CWalletDBWrapper& dbh = pwallet->GetDBHandle(); - static unsigned int nLastSeen = dbh.GetUpdateCounter(); - static unsigned int nLastFlushed = dbh.GetUpdateCounter(); - static int64_t nLastWalletUpdate = GetTime(); + unsigned int nUpdateCounter = dbh.nUpdateCounter; - if (nLastSeen != dbh.GetUpdateCounter()) - { - nLastSeen = dbh.GetUpdateCounter(); - nLastWalletUpdate = GetTime(); - } + if (dbh.nLastSeen != nUpdateCounter) { + dbh.nLastSeen = nUpdateCounter; + dbh.nLastWalletUpdate = GetTime(); + } - if (nLastFlushed != dbh.GetUpdateCounter() && GetTime() - nLastWalletUpdate >= 2) - { - if (CDB::PeriodicFlush(dbh)) { - nLastFlushed = dbh.GetUpdateCounter(); + if (dbh.nLastFlushed != nUpdateCounter && GetTime() - dbh.nLastWalletUpdate >= 2) { + if (CDB::PeriodicFlush(dbh)) { + dbh.nLastFlushed = nUpdateCounter; + } } } + fOneThread = false; } |