Skip to content

Commit ed67100

Browse files
committed
Add required locks in tests
Unit tests with DEBUG_LOCKORDER were running into assertions.
1 parent bbe53f6 commit ed67100

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/test/rpc_wallet_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet)
6565
// Test RPC calls for various wallet statistics
6666
Value r;
6767

68-
LOCK(pwalletMain->cs_wallet);
68+
LOCK2(cs_main, pwalletMain->cs_wallet);
6969

7070
BOOST_CHECK_NO_THROW(CallRPC("listunspent"));
7171
BOOST_CHECK_THROW(CallRPC("listunspent string"), runtime_error);

src/test/script_P2SH_tests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ BOOST_AUTO_TEST_SUITE(script_P2SH_tests)
5050

5151
BOOST_AUTO_TEST_CASE(sign)
5252
{
53+
LOCK(cs_main);
5354
// Pay-to-script-hash looks like this:
5455
// scriptSig: <sig> <sig...> <serialized_script>
5556
// scriptPubKey: HASH160 <hash> EQUAL
@@ -147,6 +148,7 @@ BOOST_AUTO_TEST_CASE(norecurse)
147148

148149
BOOST_AUTO_TEST_CASE(set)
149150
{
151+
LOCK(cs_main);
150152
// Test the CScript::Set* methods
151153
CBasicKeyStore keystore;
152154
CKey key[4];
@@ -250,6 +252,7 @@ BOOST_AUTO_TEST_CASE(switchover)
250252

251253
BOOST_AUTO_TEST_CASE(AreInputsStandard)
252254
{
255+
LOCK(cs_main);
253256
CCoinsView coinsDummy;
254257
CCoinsViewCache coins(coinsDummy);
255258
CBasicKeyStore keystore;

src/test/transaction_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ BOOST_AUTO_TEST_CASE(test_Get)
254254

255255
BOOST_AUTO_TEST_CASE(test_IsStandard)
256256
{
257+
LOCK(cs_main);
257258
CBasicKeyStore keystore;
258259
CCoinsView coinsDummy;
259260
CCoinsViewCache coins(coinsDummy);

0 commit comments

Comments
 (0)