Skip to content

Commit

Permalink
sapling_rpc_wallet_tests: remove unneeded cs_main and cs_wallet locks.
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Feb 21, 2021
1 parent c3a281c commit 0dfebf4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/test/librust/sapling_rpc_wallet_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_getbalance)
{
SelectParams(CBaseChainParams::TESTNET);

LOCK2(cs_main, pwalletMain->cs_wallet);
{
LOCK(pwalletMain->cs_wallet);
pwalletMain->SetMinVersion(FEATURE_SAPLING);
pwalletMain->SetupSPKM(false);
}

BOOST_CHECK_THROW(CallRPC("getshieldbalance too many args"), std::runtime_error);
BOOST_CHECK_THROW(CallRPC("getshieldbalance invalidaddress"), std::runtime_error);
Expand Down Expand Up @@ -249,7 +253,11 @@ BOOST_AUTO_TEST_CASE(rpc_shieldsendmany_parameters)
{
SelectParams(CBaseChainParams::TESTNET);

LOCK2(cs_main, pwalletMain->cs_wallet);
{
LOCK(pwalletMain->cs_wallet);
pwalletMain->SetMinVersion(FEATURE_SAPLING);
pwalletMain->SetupSPKM(false);
}

BOOST_CHECK_THROW(CallRPC("shieldsendmany"), std::runtime_error);
BOOST_CHECK_THROW(CallRPC("shieldsendmany toofewargs"), std::runtime_error);
Expand Down Expand Up @@ -299,7 +307,6 @@ BOOST_AUTO_TEST_CASE(rpc_shieldsendmany_parameters)
std::vector<char> v (2 * (ZC_MEMO_SIZE+1)); // x2 for hexadecimal string format
std::fill(v.begin(),v.end(), 'A');
std::string badmemo(v.begin(), v.end());
pwalletMain->SetupSPKM(false);
auto pa = pwalletMain->GenerateNewSaplingZKey();
std::string zaddr1 = KeyIO::EncodePaymentAddress(pa);
BOOST_CHECK_THROW(CallRPC(std::string("shieldsendmany yBYhwgzufrZ6F5VVuK9nEChENArq934mqC ")
Expand Down Expand Up @@ -543,8 +550,10 @@ BOOST_AUTO_TEST_CASE(rpc_listshieldunspent_parameters)
{
SelectParams(CBaseChainParams::TESTNET);

LOCK2(cs_main, pwalletMain->cs_wallet);
pwalletMain->SetupSPKM(false);
{
LOCK(pwalletMain->cs_wallet);
pwalletMain->SetupSPKM(false);
}

UniValue retValue;

Expand Down

0 comments on commit 0dfebf4

Please sign in to comment.