Unit test fixes for AssertLockHeld / -DDEBUG_LOCKORDER

Unit tests would fail if compiled with -DDEBUG_LOCKORDER (AssertLockHeld()
would fail; AssertLockHeld() relies on the DEBUG_LOCKORDER code to keep
track of locks held).

Fixed by LOCK'ing the wallet mutex in the unit tests that manipulate the
wallet.
This commit is contained in:
Gavin Andresen
2014-01-23 14:18:26 -05:00
parent d0a94f2c2f
commit fd67424c82
3 changed files with 11 additions and 0 deletions

View File

@@ -62,6 +62,8 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests)
CoinSet setCoinsRet, setCoinsRet2;
int64_t nValueRet;
LOCK(wallet.cs_wallet);
// test multiple times to allow for differences in the shuffle order
for (int i = 0; i < RUN_TESTS; i++)
{