mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
partial bitcoin#18923: Never schedule MaybeCompactWalletDB when -flushwallet is off
Excludes faf8401c195f52470d1ca6e2c94cb3820e57ee41 and fa28a618972911239a119248ab1194702a5c36d8
This commit is contained in:
parent
71bb9def32
commit
6267fa8427
@ -63,9 +63,10 @@ void AppTests::appTests()
|
||||
}
|
||||
#endif
|
||||
|
||||
BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to
|
||||
ECC_Stop(); // Already started by the common test setup, so stop it to avoid interference
|
||||
LogInstance().DisconnectTestLogger();
|
||||
fs::create_directories([] {
|
||||
BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to
|
||||
return GetDataDir() / "blocks";
|
||||
}());
|
||||
|
||||
m_app.parameterSetup();
|
||||
GUIUtil::loadFonts();
|
||||
@ -83,6 +84,7 @@ void AppTests::appTests()
|
||||
m_app.exec();
|
||||
|
||||
// Reset global state to avoid interfering with later tests.
|
||||
LogInstance().DisconnectTestLogger();
|
||||
AbortShutdown();
|
||||
UnloadBlockIndex();
|
||||
}
|
||||
|
@ -614,8 +614,8 @@ bool BerkeleyDatabase::PeriodicFlush()
|
||||
if (!lockDb) return false;
|
||||
|
||||
// Don't flush if any databases are in use
|
||||
for (auto it = env->mapFileUseCount.begin() ; it != env->mapFileUseCount.end(); it++) {
|
||||
if ((*it).second > 0) return false;
|
||||
for (const auto& use_count : env->mapFileUseCount) {
|
||||
if (use_count.second > 0) return false;
|
||||
}
|
||||
|
||||
// Don't flush if there haven't been any batch writes for this database.
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <wallet/wallet.h>
|
||||
#include <wallet/walletdb.h>
|
||||
|
||||
bool VerifyWallets(interfaces::Chain& chain, const std::vector<std::string>& wallet_files)
|
||||
{
|
||||
@ -92,7 +93,9 @@ void StartWallets(CScheduler& scheduler)
|
||||
}
|
||||
|
||||
// Schedule periodic wallet flushes and tx rebroadcasts
|
||||
scheduler.scheduleEvery(MaybeCompactWalletDB, 500);
|
||||
if (gArgs.GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET)) {
|
||||
scheduler.scheduleEvery(MaybeCompactWalletDB, 500);
|
||||
}
|
||||
scheduler.scheduleEvery(MaybeResendWalletTxs, 1000);
|
||||
}
|
||||
|
||||
|
@ -737,9 +737,6 @@ void MaybeCompactWalletDB()
|
||||
if (fOneThread.exchange(true)) {
|
||||
return;
|
||||
}
|
||||
if (!gArgs.GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) {
|
||||
WalletDatabase& dbh = pwallet->GetDBHandle();
|
||||
|
Loading…
Reference in New Issue
Block a user