Skip to content

Commit

Permalink
Make shutdown handling safer (#1404)
Browse files Browse the repository at this point in the history
* Make shutdown behavior safer

Co-authored-by: Peter Bushnell <[email protected]>
  • Loading branch information
prasannavl and Bushstar authored Aug 2, 2022
1 parent 2247f0f commit 4783aa0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,10 @@ static void ThreadImport(std::vector<fs::path> vImportFiles)
if (file) {
LogPrintf("Importing blocks file %s...\n", path.string());
LoadExternalBlockFile(chainparams, file);
if (ShutdownRequested()) {
LogPrintf("Shutdown requested. Exit %s\n", __func__);
return;
}
} else {
LogPrintf("Warning: Could not open blocks file %s\n", path.string());
}
Expand Down
2 changes: 0 additions & 2 deletions src/masternodes/anchors.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,6 @@ class CAnchorIndex

while (pcursor->Valid())
{
// ShutdownRequested replaces interruption_point
if (ShutdownRequested()) break;
std::pair<char, Key> key;
if (pcursor->GetKey(key) && key.first == prefix)
{
Expand Down
6 changes: 1 addition & 5 deletions src/spv/spv_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ class CSpvWrapper

while (pcursor->Valid())
{
// ShutdownRequested replaces interruption_point
if (ShutdownRequested()) break;
std::pair<char, Key> key;
if (pcursor->GetKey(key) && key.first == prefix)
{
Expand Down Expand Up @@ -226,8 +224,6 @@ class CSpvWrapper

while (pcursor->Valid())
{
// ShutdownRequested replaces interruption_point
if (ShutdownRequested()) break;
std::pair<char, Key> key;
if (pcursor->GetKey(key) && key.first == prefix)
{
Expand Down Expand Up @@ -256,7 +252,7 @@ class CFakeSpvWrapper : public CSpvWrapper
CFakeSpvWrapper();

void Connect() override;
void Disconnect() override;
void Disconnect() override;
bool IsConnected() const override;
void CancelPendingTxs() override;

Expand Down

0 comments on commit 4783aa0

Please sign in to comment.