mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-08 10:51:17 +02:00
init: Stop indexes on shutdown after ChainStateFlushed callback.
Currently, the latest index state may not be committed to disk on shutdown.
This commit is contained in:
parent
6196e93001
commit
9dd58ca611
12
src/init.cpp
12
src/init.cpp
@ -197,8 +197,6 @@ void Shutdown(NodeContext& node)
|
|||||||
// using the other before destroying them.
|
// using the other before destroying them.
|
||||||
if (node.peer_logic) UnregisterValidationInterface(node.peer_logic.get());
|
if (node.peer_logic) UnregisterValidationInterface(node.peer_logic.get());
|
||||||
if (node.connman) node.connman->Stop();
|
if (node.connman) node.connman->Stop();
|
||||||
if (g_txindex) g_txindex->Stop();
|
|
||||||
ForEachBlockFilterIndex([](BlockFilterIndex& index) { index.Stop(); });
|
|
||||||
|
|
||||||
StopTorControl();
|
StopTorControl();
|
||||||
|
|
||||||
@ -212,8 +210,6 @@ void Shutdown(NodeContext& node)
|
|||||||
node.peer_logic.reset();
|
node.peer_logic.reset();
|
||||||
node.connman.reset();
|
node.connman.reset();
|
||||||
node.banman.reset();
|
node.banman.reset();
|
||||||
g_txindex.reset();
|
|
||||||
DestroyAllBlockFilterIndexes();
|
|
||||||
|
|
||||||
if (::mempool.IsLoaded() && gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
|
if (::mempool.IsLoaded() && gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
|
||||||
DumpMempool(::mempool);
|
DumpMempool(::mempool);
|
||||||
@ -246,6 +242,14 @@ void Shutdown(NodeContext& node)
|
|||||||
// CValidationInterface callbacks, flush them...
|
// CValidationInterface callbacks, flush them...
|
||||||
GetMainSignals().FlushBackgroundCallbacks();
|
GetMainSignals().FlushBackgroundCallbacks();
|
||||||
|
|
||||||
|
// Stop and delete all indexes only after flushing background callbacks.
|
||||||
|
if (g_txindex) {
|
||||||
|
g_txindex->Stop();
|
||||||
|
g_txindex.reset();
|
||||||
|
}
|
||||||
|
ForEachBlockFilterIndex([](BlockFilterIndex& index) { index.Stop(); });
|
||||||
|
DestroyAllBlockFilterIndexes();
|
||||||
|
|
||||||
// Any future callbacks will be dropped. This should absolutely be safe - if
|
// Any future callbacks will be dropped. This should absolutely be safe - if
|
||||||
// missing a callback results in an unrecoverable situation, unclean shutdown
|
// missing a callback results in an unrecoverable situation, unclean shutdown
|
||||||
// would too. The only reason to do the above flushes is to let the wallet catch
|
// would too. The only reason to do the above flushes is to let the wallet catch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user