aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-01-22 11:08:31 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-01-22 11:10:21 +0100
commit4cf73504220e95ea1c4961509ea757ce6d393a9b (patch)
tree1359256ff11fae045c5f817089b2d1e41f653361
parent98159132c3e7f3ea62dc8d3e0afc1e49a6000c3d (diff)
parent9d980c1f7f6fd0eb686d3cc94ba4698547f151c2 (diff)
downloadbitcoin-4cf73504220e95ea1c4961509ea757ce6d393a9b.tar.xz
Merge branch '0.19_2' into 0.19
There was an accidental direct push to the 0.19 branch, add a merge commit with signature and treehash to make verify-commits happy again. Tree-SHA512: 47e9f37ec2b8d8402cf3d05f71713ef7e71843dd8360d68e21f99dcd285fc397171907102aad8e6e8525097f589f3c419f1f0c18ff66c7e45a553af8625a0842
-rw-r--r--src/init.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 543194c2e3..ccb5962c48 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -199,8 +199,6 @@ void Shutdown(InitInterfaces& interfaces)
// using the other before destroying them.
if (peerLogic) UnregisterValidationInterface(peerLogic.get());
if (g_connman) g_connman->Stop();
- if (g_txindex) g_txindex->Stop();
- ForEachBlockFilterIndex([](BlockFilterIndex& index) { index.Stop(); });
StopTorControl();
@@ -214,8 +212,6 @@ void Shutdown(InitInterfaces& interfaces)
peerLogic.reset();
g_connman.reset();
g_banman.reset();
- g_txindex.reset();
- DestroyAllBlockFilterIndexes();
if (::mempool.IsLoaded() && gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
DumpMempool(::mempool);
@@ -248,6 +244,14 @@ void Shutdown(InitInterfaces& interfaces)
// CValidationInterface callbacks, flush them...
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
// 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