Skip to content

Commit

Permalink
Allow shutdown during LoadMempool, dump only when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasschnelli committed Dec 23, 2016
1 parent 041331e commit 9479f8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -209,7 +210,8 @@ void Shutdown()

StopTorControl();
UnregisterNodeSignals(GetNodeSignals());
DumpMempool();
if (fDumpMempoolLater)
DumpMempool();

if (fFeeEstimatesInitialized)
{
Expand Down Expand Up @@ -667,6 +669,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
}
} // End scope of CImportingNow
LoadMempool();
fDumpMempoolLater = !fRequestShutdown;
}

/** Sanity checks
Expand Down
2 changes: 2 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,8 @@ bool LoadMempool(void)
} else {
++skipped;
}
if (ShutdownRequested())
return false;
}
std::map<uint256, CAmount> mapDeltas;
file >> mapDeltas;
Expand Down

0 comments on commit 9479f8d

Please sign in to comment.