mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-11 21:22:47 +01:00
Flush CValidationInterface callbacks prior to destruction
Note that the CScheduler thread cant be running at this point, it has already been stopped with the rest of the init threadgroup. Thus, just calling any remaining loose callbacks during Shutdown() is sane.
This commit is contained in:
13
src/init.cpp
13
src/init.cpp
@@ -215,6 +215,19 @@ void Shutdown()
|
||||
fFeeEstimatesInitialized = false;
|
||||
}
|
||||
|
||||
// FlushStateToDisk generates a SetBestChain callback, which we should avoid missing
|
||||
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
|
||||
// up with our current chain to avoid any strange pruning edge cases and make
|
||||
// next startup faster by avoiding rescan.
|
||||
|
||||
{
|
||||
LOCK(cs_main);
|
||||
if (pcoinsTip != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user