Steps to reproduce:
$ ./configure CPPFLAGS=-DDEBUG_LOCKORDER
$ make
$ src/bitcoind -regtest -salvagewallet
Assertion failed: lock cs_wallet not held in wallet/wallet.cpp:153; locks held:
Aborted (core dumped)
Steps to reproduce:
$ ./configure CPPFLAGS=-DDEBUG_LOCKORDER
$ make
$ src/bitcoind -regtest -salvagewallet
Assertion failed: lock cs_wallet not held in wallet/wallet.cpp:153; locks held:
Aborted (core dumped)
-salvagewallet calls the CWallet::Verify() method which does not lock cs_wallet, but, some subfunctions call AssertLockHeld().
Because CWallet::Verify() can only happen over init.cpp/main thread, I guess this is tolerable.
The assert only "fires" when CPPFLAGS=-DDEBUG_LOCKORDER is enabled.
A "fix" (only a debug mode fix) would probably be a LOCK(cs_wallet) at the beginning of CWallet::Verify().
@jonasschnelli Thanks! Looks like fa33d9740c9b0d1071094ab6c1736f27a7090c95 (#7229) fixes it.