Skip to content

Commit d6cf608

Browse files
committed
[Refactor] Remove CWalletDBWrapper::GetUpdateCounter()
1 parent 4bbad5c commit d6cf608

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

src/wallet/db.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,6 @@ void CWalletDBWrapper::IncrementUpdateCounter()
433433
++nUpdateCounter;
434434
}
435435

436-
unsigned int CWalletDBWrapper::GetUpdateCounter()
437-
{
438-
return nUpdateCounter.load();
439-
}
440-
441436
void CDB::Close()
442437
{
443438
if (!pdb)

src/wallet/walletdb.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -797,24 +797,22 @@ void MaybeCompactWalletDB()
797797
return;
798798
}
799799

800-
/* TODO: fix me
801-
CWalletDBWrapper& dbh = pwalletMain->GetDBHandle();
800+
for (CWalletRef pwallet : vpwallets) {
801+
CWalletDBWrapper& dbh = pwallet->GetDBHandle();
802802

803-
static unsigned int nLastSeen = dbh.GetUpdateCounter();
804-
static unsigned int nLastFlushed = dbh.GetUpdateCounter();
805-
static int64_t nLastWalletUpdate = GetTime();
806-
807-
if (nLastSeen != dbh.GetUpdateCounter()) {
808-
nLastSeen = dbh.GetUpdateCounter();
809-
nLastWalletUpdate = GetTime();
810-
}
803+
unsigned int nUpdateCounter = dbh.nUpdateCounter;
804+
if (dbh.nLastSeen != nUpdateCounter) {
805+
dbh.nLastSeen = nUpdateCounter;
806+
dbh.nLastWalletUpdate = GetTime();
807+
}
811808

812-
if (nLastFlushed != dbh.GetUpdateCounter() && GetTime() - nLastWalletUpdate >= 2) {
813-
if (CDB::PeriodicFlush(dbh)) {
814-
nLastFlushed = dbh.GetUpdateCounter();
809+
if (dbh.nLastFlushed != nUpdateCounter && GetTime() - dbh.nLastWalletUpdate >= 2) {
810+
if (CDB::PeriodicFlush(dbh)) {
811+
dbh.nLastFlushed = nUpdateCounter;
812+
}
815813
}
816814
}
817-
*/
815+
818816
fOneThread = false;
819817
}
820818

0 commit comments

Comments
 (0)