@@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper)
28
28
// Perform tests both obfuscated and non-obfuscated.
29
29
for (const bool obfuscate : {false , true }) {
30
30
fs::path ph = m_args.GetDataDirBase () / (obfuscate ? " dbwrapper_obfuscate_true" : " dbwrapper_obfuscate_false" );
31
- CDBWrapper dbw (ph, ( 1 << 20 ), true , false , obfuscate);
31
+ CDBWrapper dbw ({. path = ph, . cache_bytes = 1 << 20 , . memory_only = true , . wipe_data = false , . obfuscate = obfuscate} );
32
32
uint8_t key{' k' };
33
33
uint256 in = InsecureRand256 ();
34
34
uint256 res;
@@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_basic_data)
47
47
// Perform tests both obfuscated and non-obfuscated.
48
48
for (bool obfuscate : {false , true }) {
49
49
fs::path ph = m_args.GetDataDirBase () / (obfuscate ? " dbwrapper_1_obfuscate_true" : " dbwrapper_1_obfuscate_false" );
50
- CDBWrapper dbw (ph, ( 1 << 20 ), false , true , obfuscate);
50
+ CDBWrapper dbw ({. path = ph, . cache_bytes = 1 << 20 , . memory_only = false , . wipe_data = true , . obfuscate = obfuscate} );
51
51
52
52
uint256 res;
53
53
uint32_t res_uint_32;
@@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_batch)
128
128
// Perform tests both obfuscated and non-obfuscated.
129
129
for (const bool obfuscate : {false , true }) {
130
130
fs::path ph = m_args.GetDataDirBase () / (obfuscate ? " dbwrapper_batch_obfuscate_true" : " dbwrapper_batch_obfuscate_false" );
131
- CDBWrapper dbw (ph, ( 1 << 20 ), true , false , obfuscate);
131
+ CDBWrapper dbw ({. path = ph, . cache_bytes = 1 << 20 , . memory_only = true , . wipe_data = false , . obfuscate = obfuscate} );
132
132
133
133
uint8_t key{' i' };
134
134
uint256 in = InsecureRand256 ();
@@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
164
164
// Perform tests both obfuscated and non-obfuscated.
165
165
for (const bool obfuscate : {false , true }) {
166
166
fs::path ph = m_args.GetDataDirBase () / (obfuscate ? " dbwrapper_iterator_obfuscate_true" : " dbwrapper_iterator_obfuscate_false" );
167
- CDBWrapper dbw (ph, ( 1 << 20 ), true , false , obfuscate);
167
+ CDBWrapper dbw ({. path = ph, . cache_bytes = 1 << 20 , . memory_only = true , . wipe_data = false , . obfuscate = obfuscate} );
168
168
169
169
// The two keys are intentionally chosen for ordering
170
170
uint8_t key{' j' };
@@ -207,7 +207,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
207
207
fs::create_directories (ph);
208
208
209
209
// Set up a non-obfuscated wrapper to write some initial data.
210
- std::unique_ptr<CDBWrapper> dbw = std::make_unique<CDBWrapper>(ph, ( 1 << 10 ), false , false , false );
210
+ std::unique_ptr<CDBWrapper> dbw = std::make_unique<CDBWrapper>(DBParams{. path = ph, . cache_bytes = 1 << 10 , . memory_only = false , . wipe_data = false , . obfuscate = false } );
211
211
uint8_t key{' k' };
212
212
uint256 in = InsecureRand256 ();
213
213
uint256 res;
@@ -220,7 +220,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
220
220
dbw.reset ();
221
221
222
222
// Now, set up another wrapper that wants to obfuscate the same directory
223
- CDBWrapper odbw (ph, ( 1 << 10 ), false , false , true );
223
+ CDBWrapper odbw ({. path = ph, . cache_bytes = 1 << 10 , . memory_only = false , . wipe_data = false , . obfuscate = true } );
224
224
225
225
// Check that the key/val we wrote with unobfuscated wrapper exists and
226
226
// is readable.
@@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
248
248
fs::create_directories (ph);
249
249
250
250
// Set up a non-obfuscated wrapper to write some initial data.
251
- std::unique_ptr<CDBWrapper> dbw = std::make_unique<CDBWrapper>(ph, ( 1 << 10 ), false , false , false );
251
+ std::unique_ptr<CDBWrapper> dbw = std::make_unique<CDBWrapper>(DBParams{. path = ph, . cache_bytes = 1 << 10 , . memory_only = false , . wipe_data = false , . obfuscate = false } );
252
252
uint8_t key{' k' };
253
253
uint256 in = InsecureRand256 ();
254
254
uint256 res;
@@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
261
261
dbw.reset ();
262
262
263
263
// Simulate a -reindex by wiping the existing data store
264
- CDBWrapper odbw (ph, ( 1 << 10 ), false , true , true );
264
+ CDBWrapper odbw ({. path = ph, . cache_bytes = 1 << 10 , . memory_only = false , . wipe_data = true , . obfuscate = true } );
265
265
266
266
// Check that the key/val we wrote with unobfuscated wrapper doesn't exist
267
267
uint256 res2;
@@ -280,7 +280,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
280
280
BOOST_AUTO_TEST_CASE (iterator_ordering)
281
281
{
282
282
fs::path ph = m_args.GetDataDirBase () / " iterator_ordering" ;
283
- CDBWrapper dbw (ph, ( 1 << 20 ), true , false , false );
283
+ CDBWrapper dbw ({. path = ph, . cache_bytes = 1 << 20 , . memory_only = true , . wipe_data = false , . obfuscate = false } );
284
284
for (int x=0x00 ; x<256 ; ++x) {
285
285
uint8_t key = x;
286
286
uint32_t value = x*x;
@@ -348,7 +348,7 @@ struct StringContentsSerializer {
348
348
BOOST_AUTO_TEST_CASE (iterator_string_ordering)
349
349
{
350
350
fs::path ph = m_args.GetDataDirBase () / " iterator_string_ordering" ;
351
- CDBWrapper dbw (ph, ( 1 << 20 ), true , false , false );
351
+ CDBWrapper dbw ({. path = ph, . cache_bytes = 1 << 20 , . memory_only = true , . wipe_data = false , . obfuscate = false } );
352
352
for (int x = 0 ; x < 10 ; ++x) {
353
353
for (int y = 0 ; y < 10 ; ++y) {
354
354
std::string key{ToString (x)};
@@ -390,7 +390,7 @@ BOOST_AUTO_TEST_CASE(unicodepath)
390
390
// the ANSI CreateDirectoryA call and the code page isn't UTF8.
391
391
// It will succeed if created with CreateDirectoryW.
392
392
fs::path ph = m_args.GetDataDirBase () / " test_runner_₿_🏃_20191128_104644" ;
393
- CDBWrapper dbw (ph, ( 1 << 20 ) );
393
+ CDBWrapper dbw ({. path = ph, . cache_bytes = 1 << 20 } );
394
394
395
395
fs::path lockPath = ph / " LOCK" ;
396
396
BOOST_CHECK (fs::exists (lockPath));
0 commit comments