locks: don't lock cs_wallet before making rpc calls

This commit is contained in:
Cory Fields 2015-08-07 16:15:38 -04:00
parent c0f66ce44a
commit 605433ffb5
1 changed files with 18 additions and 17 deletions

View File

@ -27,8 +27,6 @@ BOOST_FIXTURE_TEST_SUITE(rpc_wallet_tests, TestingSetup)
BOOST_AUTO_TEST_CASE(rpc_addmultisig) BOOST_AUTO_TEST_CASE(rpc_addmultisig)
{ {
LOCK(pwalletMain->cs_wallet);
rpcfn_type addmultisig = tableRPC["addmultisigaddress"]->actor; rpcfn_type addmultisig = tableRPC["addmultisigaddress"]->actor;
// old, 65-byte-long: // old, 65-byte-long:
@ -68,25 +66,28 @@ BOOST_AUTO_TEST_CASE(rpc_wallet)
{ {
// Test RPC calls for various wallet statistics // Test RPC calls for various wallet statistics
UniValue r; UniValue r;
CPubKey demoPubkey;
LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress demoAddress;
CPubKey demoPubkey = pwalletMain->GenerateNewKey();
CBitcoinAddress demoAddress = CBitcoinAddress(CTxDestination(demoPubkey.GetID()));
UniValue retValue; UniValue retValue;
string strAccount = "walletDemoAccount"; string strAccount = "walletDemoAccount";
string strPurpose = "receive"; CBitcoinAddress setaccountDemoAddress;
BOOST_CHECK_NO_THROW({ /*Initialize Wallet with an account */ {
CWalletDB walletdb(pwalletMain->strWalletFile); LOCK(pwalletMain->cs_wallet);
CAccount account;
account.vchPubKey = demoPubkey;
pwalletMain->SetAddressBook(account.vchPubKey.GetID(), strAccount, strPurpose);
walletdb.WriteAccount(strAccount, account);
});
CPubKey setaccountDemoPubkey = pwalletMain->GenerateNewKey(); demoPubkey = pwalletMain->GenerateNewKey();
CBitcoinAddress setaccountDemoAddress = CBitcoinAddress(CTxDestination(setaccountDemoPubkey.GetID())); 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 * setaccount
*********************************/ *********************************/