diff --git a/src/wallet/test/walletdb_tests.cpp b/src/wallet/test/walletdb_tests.cpp --- a/src/wallet/test/walletdb_tests.cpp +++ b/src/wallet/test/walletdb_tests.cpp @@ -13,17 +13,6 @@ #include namespace { -static std::unique_ptr TmpDB(const fs::path &pathTemp, - const std::string &testname) { - fs::path dir = pathTemp / testname; - BOOST_CHECK_MESSAGE(fs::create_directory(dir), - "Unable to create a directory for test " + testname); - fs::path path = - dir / strprintf("testwallet%i", static_cast(GetRand(1000000))); - return std::unique_ptr( - new CWalletDBWrapper(&bitdb, path.string())); -} - static std::unique_ptr LoadWallet(CWalletDB *db) { std::unique_ptr wallet(new CWallet(Params())); DBErrors res = db->LoadWallet(wallet.get()); @@ -35,8 +24,7 @@ BOOST_FIXTURE_TEST_SUITE(walletdb_tests, WalletTestingSetup) BOOST_AUTO_TEST_CASE(write_erase_name) { - auto walletdbwrapper = TmpDB(pathTemp, "write_erase_name"); - CWalletDB walletdb(*walletdbwrapper, "cr+"); + CWalletDB walletdb(pwalletMain->GetDBHandle(), "cr+"); CTxDestination dst1 = CKeyID(uint160S("c0ffee")); CTxDestination dst2 = CKeyID(uint160S("f00d")); @@ -60,8 +48,7 @@ } BOOST_AUTO_TEST_CASE(write_erase_purpose) { - auto walletdbwrapper = TmpDB(pathTemp, "write_erase_purpose"); - CWalletDB walletdb(*walletdbwrapper, "cr+"); + CWalletDB walletdb(pwalletMain->GetDBHandle(), "cr+"); CTxDestination dst1 = CKeyID(uint160S("c0ffee")); CTxDestination dst2 = CKeyID(uint160S("f00d")); @@ -85,8 +72,7 @@ } BOOST_AUTO_TEST_CASE(write_erase_destdata) { - auto walletdbwrapper = TmpDB(pathTemp, "write_erase_destdata"); - CWalletDB walletdb(*walletdbwrapper, "cr+"); + CWalletDB walletdb(pwalletMain->GetDBHandle(), "cr+"); CTxDestination dst1 = CKeyID(uint160S("c0ffee")); CTxDestination dst2 = CKeyID(uint160S("f00d")); @@ -121,8 +107,7 @@ } BOOST_AUTO_TEST_CASE(no_dest_fails) { - auto walletdbwrapper = TmpDB(pathTemp, "no_dest_fails"); - CWalletDB walletdb(*walletdbwrapper, "cr+"); + CWalletDB walletdb(pwalletMain->GetDBHandle(), "cr+"); CTxDestination dst = CNoDestination{}; BOOST_CHECK(!walletdb.WriteName(dst, "name"));