Skip to content

Commit

Permalink
Fix tonlib client crashing when block lookup error (#979)
Browse files Browse the repository at this point in the history
Co-authored-by: hey-researcher <ton-researcher@pm.me>
  • Loading branch information
hey-researcher and hey-researcher authored Jul 17, 2024
1 parent b9e89d4 commit 015e2e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tonlib/tonlib/TonlibClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5574,6 +5574,11 @@ td::Status TonlibClient::do_request(const tonlib_api::blocks_lookupBlock& reques
client_.with_last_block(
[self = this, blkid, lite_block = std::move(lite_block), mode = request.mode_, lt = (td::uint64)request.lt_,
utime = (td::uint32)request.utime_, promise = std::move(promise)](td::Result<LastBlockState> r_last_block) mutable {
if (r_last_block.is_error()) {
promise.set_error(r_last_block.move_as_error_prefix(TonlibError::Internal("get last block failed ")));
return;
}

self->client_.send_query(ton::lite_api::liteServer_lookupBlockWithProof(mode, std::move(lite_block), ton::create_tl_lite_block_id(r_last_block.ok().last_block_id), lt, utime),
promise.wrap([blkid, mode, utime, lt, last_block = r_last_block.ok().last_block_id](lite_api_ptr<ton::lite_api::liteServer_lookupBlockResult>&& result)
-> td::Result<object_ptr<tonlib_api::ton_blockIdExt>> {
Expand Down

0 comments on commit 015e2e5

Please sign in to comment.