mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-09 20:23:35 +01:00
Wallet: Replace pwalletMain with a vector of wallet pointers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user