Skip to content

Commit 46b249e

Browse files
committed
Merge #9408: Allow shutdown during LoadMempool, dump only when necessary
325e400 [Qt] Do proper shutdown (Jonas Schnelli) 9479f8d Allow shutdown during LoadMempool, dump only when necessary (Jonas Schnelli)
2 parents a55716a + 325e400 commit 46b249e

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/init.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
130130
//
131131

132132
std::atomic<bool> fRequestShutdown(false);
133+
std::atomic<bool> fDumpMempoolLater(false);
133134

134135
void StartShutdown()
135136
{
@@ -211,7 +212,8 @@ void Shutdown()
211212

212213
StopTorControl();
213214
UnregisterNodeSignals(GetNodeSignals());
214-
DumpMempool();
215+
if (fDumpMempoolLater)
216+
DumpMempool();
215217

216218
if (fFeeEstimatesInitialized)
217219
{
@@ -669,6 +671,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
669671
}
670672
} // End scope of CImportingNow
671673
LoadMempool();
674+
fDumpMempoolLater = !fRequestShutdown;
672675
}
673676

674677
/** Sanity checks

src/qt/bitcoin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ void BitcoinApplication::requestShutdown()
444444
delete clientModel;
445445
clientModel = 0;
446446

447+
StartShutdown();
448+
447449
// Request shutdown from core thread
448450
Q_EMIT requestedShutdown();
449451
}

src/validation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,6 +4099,8 @@ bool LoadMempool(void)
40994099
} else {
41004100
++skipped;
41014101
}
4102+
if (ShutdownRequested())
4103+
return false;
41024104
}
41034105
std::map<uint256, CAmount> mapDeltas;
41044106
file >> mapDeltas;

0 commit comments

Comments
 (0)