diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp index f93197350d0..72b8fefcc71 100644 --- a/src/bitcoin-chainstate.cpp +++ b/src/bitcoin-chainstate.cpp @@ -256,7 +256,7 @@ epilogue: } GetMainSignals().UnregisterBackgroundSignalScheduler(); - UnloadBlockIndex(nullptr, chainman); + WITH_LOCK(::cs_main, UnloadBlockIndex(nullptr, chainman)); init::UnsetGlobals(); }