Skip to content

Commit

Permalink
Fix segfault when shutting down before fully loading
Browse files Browse the repository at this point in the history
This was introduced by 3192975.
It can be triggered easily when canceling DB upgrade from
pre-per-utxo.
  • Loading branch information
TheBlueMatt authored and random-zebra committed Mar 2, 2021
1 parent 5f1f014 commit 43cc880
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ void PrepareShutdown()
}

// FlushStateToDisk generates a SetBestChain callback, which we should avoid missing
FlushStateToDisk();
if (pcoinsTip != nullptr) {
FlushStateToDisk();
}

// After there are no more peers/RPC left to give us new data which may generate
// CValidationInterface callbacks, flush them...
Expand Down

0 comments on commit 43cc880

Please sign in to comment.