mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +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
|
#endif
|
||||||
|
|
||||||
BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to
|
fs::create_directories([] {
|
||||||
ECC_Stop(); // Already started by the common test setup, so stop it to avoid interference
|
BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to
|
||||||
LogInstance().DisconnectTestLogger();
|
return GetDataDir() / "blocks";
|
||||||
|
}());
|
||||||
|
|
||||||
m_app.parameterSetup();
|
m_app.parameterSetup();
|
||||||
GUIUtil::loadFonts();
|
GUIUtil::loadFonts();
|
||||||
@ -83,6 +84,7 @@ void AppTests::appTests()
|
|||||||
m_app.exec();
|
m_app.exec();
|
||||||
|
|
||||||
// Reset global state to avoid interfering with later tests.
|
// Reset global state to avoid interfering with later tests.
|
||||||
|
LogInstance().DisconnectTestLogger();
|
||||||
AbortShutdown();
|
AbortShutdown();
|
||||||
UnloadBlockIndex();
|
UnloadBlockIndex();
|
||||||
}
|
}
|
||||||
|
@ -614,8 +614,8 @@ bool BerkeleyDatabase::PeriodicFlush()
|
|||||||
if (!lockDb) return false;
|
if (!lockDb) return false;
|
||||||
|
|
||||||
// Don't flush if any databases are in use
|
// Don't flush if any databases are in use
|
||||||
for (auto it = env->mapFileUseCount.begin() ; it != env->mapFileUseCount.end(); it++) {
|
for (const auto& use_count : env->mapFileUseCount) {
|
||||||
if ((*it).second > 0) return false;
|
if (use_count.second > 0) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't flush if there haven't been any batch writes for this database.
|
// Don't flush if there haven't been any batch writes for this database.
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
#include <util/translation.h>
|
#include <util/translation.h>
|
||||||
#include <wallet/wallet.h>
|
#include <wallet/wallet.h>
|
||||||
|
#include <wallet/walletdb.h>
|
||||||
|
|
||||||
bool VerifyWallets(interfaces::Chain& chain, const std::vector<std::string>& wallet_files)
|
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
|
// 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);
|
scheduler.scheduleEvery(MaybeResendWalletTxs, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,9 +737,6 @@ void MaybeCompactWalletDB()
|
|||||||
if (fOneThread.exchange(true)) {
|
if (fOneThread.exchange(true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!gArgs.GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) {
|
for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) {
|
||||||
WalletDatabase& dbh = pwallet->GetDBHandle();
|
WalletDatabase& dbh = pwallet->GetDBHandle();
|
||||||
|
Loading…
Reference in New Issue
Block a user