mirror of
https://codeberg.org/wownero/wownero-lws
synced 2026-01-09 15:15:15 -08:00
Hopefully fix issue with db corruption (bad data size) (#199)
This commit is contained in:
committed by
Lee *!* Clagett
parent
151d3092a7
commit
26a882965f
@@ -2975,6 +2975,7 @@ namespace db
|
|||||||
auto old_dict = subaddress_ranges.get_value(value);
|
auto old_dict = subaddress_ranges.get_value(value);
|
||||||
if (!old_dict)
|
if (!old_dict)
|
||||||
return old_dict.error();
|
return old_dict.error();
|
||||||
|
mdb_cursor_del(ranges_cur.get(), 0); // updated at end
|
||||||
|
|
||||||
auto& old_range = old_dict->second.get_container();
|
auto& old_range = old_dict->second.get_container();
|
||||||
const auto& new_range = major_entry.second.get_container();
|
const auto& new_range = major_entry.second.get_container();
|
||||||
@@ -3043,7 +3044,9 @@ namespace db
|
|||||||
|
|
||||||
value = lmdb::to_val(new_value);
|
value = lmdb::to_val(new_value);
|
||||||
|
|
||||||
MONERO_LMDB_CHECK(mdb_cursor_put(indexes_cur.get(), &key, &value, 0));
|
const int err = mdb_cursor_put(indexes_cur.get(), &key, &value, MDB_NODUPDATA);
|
||||||
|
if (err && err != MDB_KEYEXIST)
|
||||||
|
return {lmdb::error(err)};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3052,7 +3055,7 @@ namespace db
|
|||||||
if (!value_bytes)
|
if (!value_bytes)
|
||||||
return value_bytes.error();
|
return value_bytes.error();
|
||||||
value = MDB_val{value_bytes->size(), const_cast<void*>(static_cast<const void*>(value_bytes->data()))};
|
value = MDB_val{value_bytes->size(), const_cast<void*>(static_cast<const void*>(value_bytes->data()))};
|
||||||
MONERO_LMDB_CHECK(mdb_cursor_put(ranges_cur.get(), &key, &value, 0));
|
MONERO_LMDB_CHECK(mdb_cursor_put(ranges_cur.get(), &key, &value, MDB_NODUPDATA));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {std::move(out)};
|
return {std::move(out)};
|
||||||
|
|||||||
Reference in New Issue
Block a user