mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Improve CellDb migration (#835)
* Fix deserializing cells * Use proxy actor * Add delays * Print stats every minute Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
ace934ff35
commit
83efcebad0
6 changed files with 82 additions and 25 deletions
|
@ -930,7 +930,7 @@ unsigned long long BagOfCells::get_idx_entry_raw(int index) {
|
|||
*
|
||||
*/
|
||||
|
||||
td::Result<Ref<Cell>> std_boc_deserialize(td::Slice data, bool can_be_empty) {
|
||||
td::Result<Ref<Cell>> std_boc_deserialize(td::Slice data, bool can_be_empty, bool allow_nonzero_level) {
|
||||
if (data.empty() && can_be_empty) {
|
||||
return Ref<Cell>();
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ td::Result<Ref<Cell>> std_boc_deserialize(td::Slice data, bool can_be_empty) {
|
|||
if (root.is_null()) {
|
||||
return td::Status::Error("bag of cells has null root cell (?)");
|
||||
}
|
||||
if (root->get_level() != 0) {
|
||||
if (!allow_nonzero_level && root->get_level() != 0) {
|
||||
return td::Status::Error("bag of cells has a root with non-zero level");
|
||||
}
|
||||
return std::move(root);
|
||||
|
|
|
@ -323,7 +323,7 @@ class BagOfCells {
|
|||
std::vector<td::uint8>* cell_should_cache);
|
||||
};
|
||||
|
||||
td::Result<Ref<Cell>> std_boc_deserialize(td::Slice data, bool can_be_empty = false);
|
||||
td::Result<Ref<Cell>> std_boc_deserialize(td::Slice data, bool can_be_empty = false, bool allow_nonzero_level = false);
|
||||
td::Result<td::BufferSlice> std_boc_serialize(Ref<Cell> root, int mode = 0);
|
||||
|
||||
td::Result<std::vector<Ref<Cell>>> std_boc_deserialize_multi(td::Slice data,
|
||||
|
|
|
@ -98,7 +98,7 @@ class RefcntCellParser {
|
|||
auto size = parser.get_left_len();
|
||||
td::Slice data = parser.template fetch_string_raw<td::Slice>(size);
|
||||
if (stored_boc_) {
|
||||
TRY_RESULT(boc, vm::std_boc_deserialize(data));
|
||||
TRY_RESULT(boc, vm::std_boc_deserialize(data, false, true));
|
||||
TRY_RESULT(loaded_cell, boc->load_cell());
|
||||
cell = std::move(loaded_cell.data_cell);
|
||||
return td::Status::OK();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue