From boost signal documentation at https://www.boost.org/doc/libs/1_72_0/doc/html/signals2/thread-safety.html:
When a signal is invoked by calling signal::operator(), the invocation first acquires a lock on the signal’s mutex. Then it obtains a handle to the signal’s slot list and combiner. Next it releases the signal’s mutex, before invoking the combiner to iterate through the slot list.
This means that UnregisterValidationInterface
doesn’t prevent more calls to that interface.
This PR fixes the assumption that no validation calls happen after UnregisterValidationInterface
in the following code https://github.com/bitcoin/bitcoin/blob/5d92ac26ed8984c29eabc4b78bcddd2423e68dac/src/wallet/wallet.cpp#L114-L115
The actual bug is that delete wallet
races with the validation notifications.
The fix consists in synchronizing with the validation queue (which happens in BlockUntilSyncedToCurrentChain
) after UnregisterValidationInterface
.