dash/src/wallet
Wladimir J. van der Laan 2f8512b923
Merge #11126: Acquire cs_main lock before cs_wallet during wallet initialization
de9a1db Acquire cs_main lock before cs_wallet during wallet initialization (Russell Yanofsky)

Pull request description:

  `CWallet::MarkConflicted` may acquire the `cs_main` lock after `CWalletDB::LoadWallet` acquires the `cs_wallet` lock during wallet initialization. (`CWalletDB::LoadWallet` calls `ReadKeyValue` which calls `CWallet::LoadToWallet` which calls `CWallet::MarkConflicted`). This is the opposite order that `cs_main` and `cs_wallet` locks are acquired in the rest of the code, and so leads to `POTENTIAL DEADLOCK DETECTED` errors if bitcoin is built with `-DDEBUG_LOCKORDER`.

  This commit changes `CWallet::LoadWallet` (which calls `CWalletDB::LoadWallet`) to acquire both locks in the standard order.

  Error was reported by @luke-jr in https://botbot.me/freenode/bitcoin-core-dev/msg/90244330/

Tree-SHA512: 353fe21bc0a4a2828b41876897001a3c414d4b115ee7430925bd391d8bc396fca81661145d00996c1ba1a01516d9acf8b89fb5c3da27092f5f3aa7e37ef26ffa
2019-07-12 12:31:47 -05:00
..
test Merge #11126: Acquire cs_main lock before cs_wallet during wallet initialization 2019-07-12 12:31:47 -05:00
coincontrol.h Remove legacy InstantSend code (#3020) 2019-07-09 17:50:08 +03:00
crypter.cpp Merge #10536: Remove unreachable or otherwise redundant code 2019-07-11 10:34:46 -05:00
crypter.h Merge #10568: Remove unnecessary forward class declarations in header files 2019-07-09 13:08:20 -05:00
db.cpp Merge pull request #3023 from PastaPastaPasta/backports-0.15-pr19 2019-07-11 10:51:23 +03:00
db.h Merge pull request #3023 from PastaPastaPasta/backports-0.15-pr19 2019-07-11 10:51:23 +03:00
rpcdump.cpp Merge #10412: Improve wallet rescan API 2019-07-11 10:34:46 -05:00
rpcwallet.cpp Merge pull request #3023 from PastaPastaPasta/backports-0.15-pr19 2019-07-11 10:51:23 +03:00
rpcwallet.h Merge #8775: RPC refactoring: Access wallet using new GetWalletForJSONRPCRequest 2019-01-24 22:28:13 -06:00
wallet.cpp Merge #11126: Acquire cs_main lock before cs_wallet during wallet initialization 2019-07-12 12:31:47 -05:00
wallet.h Merge #10295: [qt] Move some WalletModel functions into CWallet 2019-07-11 10:34:46 -05:00
walletdb.cpp Merge #10536: Remove unreachable or otherwise redundant code 2019-07-11 10:34:46 -05:00
walletdb.h Backport #8694: Basic multiwallet support (#3022) 2019-07-11 10:50:52 +03:00