diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-08-10 17:36:54 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-08-10 17:38:25 +0200 |
| commit | 6c1c7fdfd6531a2abe92219af81dd0e599c2de7a (patch) | |
| tree | 0dc124ee1cc9f4e3c8b13d42853d478a6d2baf62 /src/test/rpc_wallet_tests.cpp | |
| parent | Merge pull request #6538 (diff) | |
| parent | Revert "Revert "Assert on probable deadlocks if the second lock isnt try_lock"" (diff) | |
| download | discoin-6c1c7fdfd6531a2abe92219af81dd0e599c2de7a.tar.xz discoin-6c1c7fdfd6531a2abe92219af81dd0e599c2de7a.zip | |
Merge pull request #6534
9493803 Revert "Revert "Assert on probable deadlocks if the second lock isnt try_lock"" (Cory Fields)
605433f locks: don't lock cs_wallet before making rpc calls (Cory Fields)
Diffstat (limited to 'src/test/rpc_wallet_tests.cpp')
| -rw-r--r-- | src/test/rpc_wallet_tests.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp index 9368963ff..52f41be8a 100644 --- a/src/test/rpc_wallet_tests.cpp +++ b/src/test/rpc_wallet_tests.cpp @@ -27,8 +27,6 @@ BOOST_FIXTURE_TEST_SUITE(rpc_wallet_tests, TestingSetup) BOOST_AUTO_TEST_CASE(rpc_addmultisig) { - LOCK(pwalletMain->cs_wallet); - rpcfn_type addmultisig = tableRPC["addmultisigaddress"]->actor; // old, 65-byte-long: @@ -68,25 +66,28 @@ BOOST_AUTO_TEST_CASE(rpc_wallet) { // Test RPC calls for various wallet statistics UniValue r; - - LOCK2(cs_main, pwalletMain->cs_wallet); - - CPubKey demoPubkey = pwalletMain->GenerateNewKey(); - CBitcoinAddress demoAddress = CBitcoinAddress(CTxDestination(demoPubkey.GetID())); + CPubKey demoPubkey; + CBitcoinAddress demoAddress; UniValue retValue; string strAccount = "walletDemoAccount"; - string strPurpose = "receive"; - BOOST_CHECK_NO_THROW({ /*Initialize Wallet with an account */ - CWalletDB walletdb(pwalletMain->strWalletFile); - CAccount account; - account.vchPubKey = demoPubkey; - pwalletMain->SetAddressBook(account.vchPubKey.GetID(), strAccount, strPurpose); - walletdb.WriteAccount(strAccount, account); - }); - - CPubKey setaccountDemoPubkey = pwalletMain->GenerateNewKey(); - CBitcoinAddress setaccountDemoAddress = CBitcoinAddress(CTxDestination(setaccountDemoPubkey.GetID())); - + CBitcoinAddress setaccountDemoAddress; + { + LOCK(pwalletMain->cs_wallet); + + demoPubkey = pwalletMain->GenerateNewKey(); + demoAddress = CBitcoinAddress(CTxDestination(demoPubkey.GetID())); + string strPurpose = "receive"; + BOOST_CHECK_NO_THROW({ /*Initialize Wallet with an account */ + CWalletDB walletdb(pwalletMain->strWalletFile); + CAccount account; + account.vchPubKey = demoPubkey; + pwalletMain->SetAddressBook(account.vchPubKey.GetID(), strAccount, strPurpose); + walletdb.WriteAccount(strAccount, account); + }); + + CPubKey setaccountDemoPubkey = pwalletMain->GenerateNewKey(); + setaccountDemoAddress = CBitcoinAddress(CTxDestination(setaccountDemoPubkey.GetID())); + } /********************************* * setaccount *********************************/ |