aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/walletdb.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2017-03-09 20:56:58 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2017-06-05 22:27:57 +0000
commit19b3648bb52d27c3a9674159d71726b73fe532d9 (patch)
tree06736b4b84033fdffe3e820a1d1ab40fa91b14ec /src/wallet/walletdb.cpp
parent74e87389616ce1147c65f0e49f3d84b817693ac6 (diff)
CWalletDB: Store the update counter per wallet
Diffstat (limited to 'src/wallet/walletdb.cpp')
-rw-r--r--src/wallet/walletdb.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index 75dbb2edff..149d0e0c20 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -22,8 +22,6 @@
#include <boost/foreach.hpp>
#include <boost/thread.hpp>
-static std::atomic<unsigned int> nWalletDBUpdateCounter;
-
//
// CWalletDB
//
@@ -762,20 +760,22 @@ void MaybeCompactWalletDB()
return;
}
- static unsigned int nLastSeen = CWalletDB::GetUpdateCounter();
- static unsigned int nLastFlushed = CWalletDB::GetUpdateCounter();
+ CWalletDBWrapper& dbh = pwalletMain->GetDBHandle();
+
+ static unsigned int nLastSeen = dbh.GetUpdateCounter();
+ static unsigned int nLastFlushed = dbh.GetUpdateCounter();
static int64_t nLastWalletUpdate = GetTime();
- if (nLastSeen != CWalletDB::GetUpdateCounter())
+ if (nLastSeen != dbh.GetUpdateCounter())
{
- nLastSeen = CWalletDB::GetUpdateCounter();
+ nLastSeen = dbh.GetUpdateCounter();
nLastWalletUpdate = GetTime();
}
- if (nLastFlushed != CWalletDB::GetUpdateCounter() && GetTime() - nLastWalletUpdate >= 2)
+ if (nLastFlushed != dbh.GetUpdateCounter() && GetTime() - nLastWalletUpdate >= 2)
{
- if (CDB::PeriodicFlush(pwalletMain->GetDBHandle())) {
- nLastFlushed = CWalletDB::GetUpdateCounter();
+ if (CDB::PeriodicFlush(dbh)) {
+ nLastFlushed = dbh.GetUpdateCounter();
}
}
fOneThread = false;
@@ -845,16 +845,6 @@ bool CWalletDB::WriteHDChain(const CHDChain& chain)
return WriteIC(std::string("hdchain"), chain);
}
-void CWalletDB::IncrementUpdateCounter()
-{
- nWalletDBUpdateCounter++;
-}
-
-unsigned int CWalletDB::GetUpdateCounter()
-{
- return nWalletDBUpdateCounter;
-}
-
bool CWalletDB::TxnBegin()
{
return batch.TxnBegin();