From a53018eb2a94e24a72c19cc4f89d5ddf9f0957ca Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 22 Jan 2021 20:26:50 +0300 Subject: [PATCH] Flush callbacks one more time at shutdown This is needed to be able to process SetBestChain callback generated by the first FlushStateToDisk call in PrepareShutdown Partially reverts #3378 --- src/init.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 0ca7f6703275..064c5d17e1bc 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -307,6 +307,10 @@ void PrepareShutdown() FlushStateToDisk(); } + // After there are no more peers/RPC left to give us new data which may generate + // CValidationInterface callbacks, flush them... + GetMainSignals().FlushBackgroundCallbacks(); + // 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