Don’t have cs_wallet
locked while calling each context.wallet_load_fns
. A load handler can always lock cs_wallet
if needed.
The lock was added in 1c7e25db0c to satisfy TSAN. With 44c430ffac most of the code requiring the lock is in CWallet::AttachChain
. A comment is added to warn about wallets_mutex and cs_wallet lock ordering.