mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
Allow shutdown during LoadMempool, dump only when necessary
This commit is contained in:
parent
041331e1da
commit
9479f8dfcf
2 changed files with 6 additions and 1 deletions
|
@ -130,6 +130,7 @@ static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
|
||||||
//
|
//
|
||||||
|
|
||||||
std::atomic<bool> fRequestShutdown(false);
|
std::atomic<bool> fRequestShutdown(false);
|
||||||
|
std::atomic<bool> fDumpMempoolLater(false);
|
||||||
|
|
||||||
void StartShutdown()
|
void StartShutdown()
|
||||||
{
|
{
|
||||||
|
@ -209,7 +210,8 @@ void Shutdown()
|
||||||
|
|
||||||
StopTorControl();
|
StopTorControl();
|
||||||
UnregisterNodeSignals(GetNodeSignals());
|
UnregisterNodeSignals(GetNodeSignals());
|
||||||
DumpMempool();
|
if (fDumpMempoolLater)
|
||||||
|
DumpMempool();
|
||||||
|
|
||||||
if (fFeeEstimatesInitialized)
|
if (fFeeEstimatesInitialized)
|
||||||
{
|
{
|
||||||
|
@ -667,6 +669,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||||
}
|
}
|
||||||
} // End scope of CImportingNow
|
} // End scope of CImportingNow
|
||||||
LoadMempool();
|
LoadMempool();
|
||||||
|
fDumpMempoolLater = !fRequestShutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sanity checks
|
/** Sanity checks
|
||||||
|
|
|
@ -4076,6 +4076,8 @@ bool LoadMempool(void)
|
||||||
} else {
|
} else {
|
||||||
++skipped;
|
++skipped;
|
||||||
}
|
}
|
||||||
|
if (ShutdownRequested())
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
std::map<uint256, CAmount> mapDeltas;
|
std::map<uint256, CAmount> mapDeltas;
|
||||||
file >> mapDeltas;
|
file >> mapDeltas;
|
||||||
|
|
Loading…
Add table
Reference in a new issue