Browse Source

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)
0.14
Pieter Wuille 8 years ago
parent
commit
46b249e578
No known key found for this signature in database
GPG Key ID: DBA1A67379A1A931
  1. 5
      src/init.cpp
  2. 2
      src/qt/bitcoin.cpp
  3. 2
      src/validation.cpp

5
src/init.cpp

@ -130,6 +130,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat"; @@ -130,6 +130,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
//
std::atomic<bool> fRequestShutdown(false);
std::atomic<bool> fDumpMempoolLater(false);
void StartShutdown()
{
@ -211,7 +212,8 @@ void Shutdown() @@ -211,7 +212,8 @@ void Shutdown()
StopTorControl();
UnregisterNodeSignals(GetNodeSignals());
DumpMempool();
if (fDumpMempoolLater)
DumpMempool();
if (fFeeEstimatesInitialized)
{
@ -669,6 +671,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles) @@ -669,6 +671,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
}
} // End scope of CImportingNow
LoadMempool();
fDumpMempoolLater = !fRequestShutdown;
}
/** Sanity checks

2
src/qt/bitcoin.cpp

@ -444,6 +444,8 @@ void BitcoinApplication::requestShutdown() @@ -444,6 +444,8 @@ void BitcoinApplication::requestShutdown()
delete clientModel;
clientModel = 0;
StartShutdown();
// Request shutdown from core thread
Q_EMIT requestedShutdown();
}

2
src/validation.cpp

@ -4099,6 +4099,8 @@ bool LoadMempool(void) @@ -4099,6 +4099,8 @@ bool LoadMempool(void)
} else {
++skipped;
}
if (ShutdownRequested())
return false;
}
std::map<uint256, CAmount> mapDeltas;
file >> mapDeltas;

Loading…
Cancel
Save