BTCP-Rebase/src/wallet
Wladimir J. van der Laan df91e11ae1
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
2017-08-28 10:56:41 +02:00
..
test Acquire cs_main lock before cs_wallet during wallet initialization 2017-08-24 14:12:21 -04:00
coincontrol.h Make QT fee displays use GetMinimumFee instead of estimateSmartFee 2017-07-14 23:41:37 -04:00
crypter.cpp Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp> 2017-07-04 18:05:18 +02:00
crypter.h Remove vchDefaultKey and have better first run detection 2017-08-15 15:05:53 -07:00
db.cpp Merge #11017: [wallet] Close DB on error. 2017-08-15 21:24:21 +02:00
db.h Merge #9964: Add const to methods that do not modify the object for which it is called 2017-08-16 02:09:49 +02:00
feebumper.cpp Merge #10976: [MOVEONLY] Move some static functions out of wallet.h/cpp 2017-08-25 21:30:42 +02:00
feebumper.h Refactor to use CoinControl in GetMinimumFee and FeeBumper 2017-07-14 23:10:58 -04:00
fees.cpp MOVEONLY: Fee functions wallet/wallet.cpp -> wallet/fees.cpp 2017-08-14 11:19:38 -04:00
fees.h Move some static functions out of wallet.h/cpp 2017-08-14 11:19:38 -04:00
init.cpp MOVEONLY: Init functions wallet/wallet.cpp -> wallet/init.cpp 2017-08-14 11:19:38 -04:00
init.h Move some static functions out of wallet.h/cpp 2017-08-14 11:19:38 -04:00
rpcdump.cpp [wallet] Cache keyid -> keypool id mappings 2017-08-04 11:08:39 -04:00
rpcwallet.cpp Merge #10976: [MOVEONLY] Move some static functions out of wallet.h/cpp 2017-08-25 21:30:42 +02:00
rpcwallet.h scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL 2017-08-07 07:36:37 +02:00
wallet.cpp Merge #11126: Acquire cs_main lock before cs_wallet during wallet initialization 2017-08-28 10:56:41 +02:00
wallet.h Merge #10976: [MOVEONLY] Move some static functions out of wallet.h/cpp 2017-08-25 21:30:42 +02:00
walletdb.cpp Merge #10952: [wallet] Remove vchDefaultKey and have better first run detection 2017-08-18 18:56:49 +02:00
walletdb.h Merge #10952: [wallet] Remove vchDefaultKey and have better first run detection 2017-08-18 18:56:49 +02:00