Skip to content

Commit

Permalink
CellDb::load_cell workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
dungeon-master-666 committed Dec 19, 2024
1 parent 04610e3 commit e1c3196
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions validator/db/celldb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,15 +679,19 @@ void CellDb::load_cell(RootHash hash, td::Promise<td::Ref<vm::DataCell>> promise
if (!started_) {
td::actor::send_closure(cell_db_, &CellDbIn::load_cell, hash, std::move(promise));
} else {
auto P = td::PromiseCreator::lambda(
[cell_db_in = cell_db_.get(), hash, promise = std::move(promise)](td::Result<td::Ref<vm::DataCell>> R) mutable {
if (R.is_error()) {
td::actor::send_closure(cell_db_in, &CellDbIn::load_cell, hash, std::move(promise));
} else {
promise.set_result(R.move_as_ok());
}
});
boc_->load_cell_async(hash.as_slice(), async_executor, std::move(P));
// auto P = td::PromiseCreator::lambda(
// [cell_db_in = cell_db_.get(), hash, promise = std::move(promise)](td::Result<td::Ref<vm::DataCell>> R) mutable {
// if (R.is_error()) {
// td::actor::send_closure(cell_db_in, &CellDbIn::load_cell, hash, std::move(promise));
// } else {
// promise.set_result(R.move_as_ok());
// }
// });
// boc_->load_cell_async(hash.as_slice(), async_executor, std::move(P));

// CellDbIn::load_cell causes segmentation fault in case of not found.
// This is workaround to avoid it.
boc_->load_cell_async(hash.as_slice(), async_executor, std::move(promise));
}
}

Expand Down

0 comments on commit e1c3196

Please sign in to comment.