51 for (
bool obfuscate : {
false,
true}) {
52 fs::path ph = m_args.GetDataDirBase() / (obfuscate ?
"dbwrapper_1_obfuscate_true" :
"dbwrapper_1_obfuscate_false");
53 CDBWrapper dbw({.path = ph, .cache_bytes = 1 << 20, .memory_only =
false, .wipe_data =
true, .obfuscate = obfuscate});
82 BOOST_CHECK(dbw.Write(key_transaction, in_transaction));
95 uint8_t key_last_blockfile_number{
'l'};
97 BOOST_CHECK(dbw.Write(key_last_blockfile_number, lastblockfilenumber));
98 BOOST_CHECK(dbw.Read(key_last_blockfile_number, res_uint_32));
102 uint8_t key_IsReindexing{
'R'};
104 BOOST_CHECK(dbw.Write(key_IsReindexing, isInReindexing));
109 uint8_t key_lastblockhash_uxto{
'B'};
111 BOOST_CHECK(dbw.Write(key_lastblockhash_uxto, lastblock_hash));
112 BOOST_CHECK(dbw.Read(key_lastblockhash_uxto, res));
116 std::string file_option_tag =
"F";
118 std::string filename =
"randomfilename";
119 std::string key_file_option =
strprintf(
"%s%01x%s", file_option_tag,filename_length,filename);
122 BOOST_CHECK(dbw.Write(key_file_option, in_file_bool));
168 for (
const bool obfuscate : {
false,
true}) {
169 fs::path ph = m_args.GetDataDirBase() / (obfuscate ?
"dbwrapper_iterator_obfuscate_true" :
"dbwrapper_iterator_obfuscate_false");
170 CDBWrapper dbw({.path = ph, .cache_bytes = 1 << 20, .memory_only =
true, .wipe_data =
false, .obfuscate = obfuscate});
180 std::unique_ptr<CDBIterator> it(
const_cast<CDBWrapper&
>(dbw).NewIterator());
188 BOOST_REQUIRE(it->GetKey(key_res));
189 BOOST_REQUIRE(it->GetValue(val_res));
195 BOOST_REQUIRE(it->GetKey(key_res));
196 BOOST_REQUIRE(it->GetValue(val_res));
285 fs::path ph = m_args.GetDataDirBase() /
"iterator_ordering";
286 CDBWrapper dbw({.path = ph, .cache_bytes = 1 << 20, .memory_only =
true, .wipe_data =
false, .obfuscate =
false});
287 for (
int x=0x00; x<256; ++x) {
289 uint32_t value = x*x;
294 std::unique_ptr<CDBIterator> it(
const_cast<CDBWrapper&
>(dbw).NewIterator());
296 for (
unsigned int x=0x00; x<256; ++x) {
298 uint32_t value = x*x;
302 for (
const int seek_start : {0x00, 0x80}) {
303 it->Seek((uint8_t)seek_start);
304 for (
unsigned int x=seek_start; x<255; ++x) {
353 fs::path ph = m_args.GetDataDirBase() /
"iterator_string_ordering";
354 CDBWrapper dbw({.path = ph, .cache_bytes = 1 << 20, .memory_only =
true, .wipe_data =
false, .obfuscate =
false});
355 for (
int x = 0; x < 10; ++x) {
356 for (
int y = 0; y < 10; ++y) {
357 std::string key{ToString(x)};
358 for (
int z = 0; z < y; ++z)
360 uint32_t value = x*x;
365 std::unique_ptr<CDBIterator> it(
const_cast<CDBWrapper&
>(dbw).NewIterator());
366 for (
const int seek_start : {0, 5}) {
368 for (
unsigned int x = seek_start; x < 10; ++x) {
369 for (
int y = 0; y < 10; ++y) {
370 std::string exp_key{ToString(x)};
371 for (
int z = 0; z < y; ++z)
StringContentsSerializer()=default
void Unserialize(Stream &s)
void Serialize(Stream &s) const
StringContentsSerializer(const std::string &inp)