Browse Source

Allow shutdown during LoadMempool, dump only when necessary

0.14
Jonas Schnelli 8 years ago
parent
commit
9479f8dfcf
No known key found for this signature in database
GPG Key ID: 29D4BCB6416F53EC
  1. 3
      src/init.cpp
  2. 2
      src/validation.cpp

3
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()
{
@ -209,6 +210,7 @@ void Shutdown() @@ -209,6 +210,7 @@ void Shutdown()
StopTorControl();
UnregisterNodeSignals(GetNodeSignals());
if (fDumpMempoolLater)
DumpMempool();
if (fFeeEstimatesInitialized)
@ -667,6 +669,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles) @@ -667,6 +669,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
}
} // End scope of CImportingNow
LoadMempool();
fDumpMempoolLater = !fRequestShutdown;
}
/** Sanity checks

2
src/validation.cpp

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

Loading…
Cancel
Save