This is a backport of core#25148
Depends on D12784
Notes:
- there is one more occurence of NO_THREAD_SAFETY_ANALYSIS in avalanche/processor.cpp
- CWallet::IsSpent and CWallet::ReacceptWalletTransaction already had the annotation, so I also added the assertion (this is still not done on Core's master branch)