mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 13:32:47 +01:00
Use unique_ptr for dbw (CDBWrapper)
This commit is contained in:
parent
fa6d1228e9
commit
0024531625
@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
|
|||||||
create_directories(ph);
|
create_directories(ph);
|
||||||
|
|
||||||
// Set up a non-obfuscated wrapper to write some initial data.
|
// Set up a non-obfuscated wrapper to write some initial data.
|
||||||
CDBWrapper* dbw = new CDBWrapper(ph, (1 << 10), false, false, false);
|
std::unique_ptr<CDBWrapper> dbw = std::unique_ptr<CDBWrapper>(new CDBWrapper(ph, (1 << 10), false, false, false));
|
||||||
char key = 'k';
|
char key = 'k';
|
||||||
uint256 in = InsecureRand256();
|
uint256 in = InsecureRand256();
|
||||||
uint256 res;
|
uint256 res;
|
||||||
@ -135,8 +135,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
|
|||||||
BOOST_CHECK_EQUAL(res.ToString(), in.ToString());
|
BOOST_CHECK_EQUAL(res.ToString(), in.ToString());
|
||||||
|
|
||||||
// Call the destructor to free leveldb LOCK
|
// Call the destructor to free leveldb LOCK
|
||||||
delete dbw;
|
dbw.reset();
|
||||||
dbw = nullptr;
|
|
||||||
|
|
||||||
// Now, set up another wrapper that wants to obfuscate the same directory
|
// Now, set up another wrapper that wants to obfuscate the same directory
|
||||||
CDBWrapper odbw(ph, (1 << 10), false, false, true);
|
CDBWrapper odbw(ph, (1 << 10), false, false, true);
|
||||||
@ -167,7 +166,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
|
|||||||
create_directories(ph);
|
create_directories(ph);
|
||||||
|
|
||||||
// Set up a non-obfuscated wrapper to write some initial data.
|
// Set up a non-obfuscated wrapper to write some initial data.
|
||||||
CDBWrapper* dbw = new CDBWrapper(ph, (1 << 10), false, false, false);
|
std::unique_ptr<CDBWrapper> dbw = std::unique_ptr<CDBWrapper>(new CDBWrapper(ph, (1 << 10), false, false, false));
|
||||||
char key = 'k';
|
char key = 'k';
|
||||||
uint256 in = InsecureRand256();
|
uint256 in = InsecureRand256();
|
||||||
uint256 res;
|
uint256 res;
|
||||||
@ -177,8 +176,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
|
|||||||
BOOST_CHECK_EQUAL(res.ToString(), in.ToString());
|
BOOST_CHECK_EQUAL(res.ToString(), in.ToString());
|
||||||
|
|
||||||
// Call the destructor to free leveldb LOCK
|
// Call the destructor to free leveldb LOCK
|
||||||
delete dbw;
|
dbw.reset();
|
||||||
dbw = nullptr;
|
|
||||||
|
|
||||||
// Simulate a -reindex by wiping the existing data store
|
// Simulate a -reindex by wiping the existing data store
|
||||||
CDBWrapper odbw(ph, (1 << 10), false, true, true);
|
CDBWrapper odbw(ph, (1 << 10), false, true, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user