1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Increase timeout for downloading astate and add logs

This commit is contained in:
SpyCheese 2022-05-03 17:19:31 +03:00
parent 2f1ce43588
commit 21c2727dcf
4 changed files with 15 additions and 7 deletions

View file

@ -53,7 +53,7 @@ DownloadState::DownloadState(BlockIdExt block_id, BlockIdExt masterchain_block_i
void DownloadState::abort_query(td::Status reason) {
if (promise_) {
if (reason.code() == ErrorCode::notready || reason.code() == ErrorCode::timeout) {
VLOG(FULL_NODE_DEBUG) << "failed to download state " << block_id_ << "from " << download_from_ << ": " << reason;
VLOG(FULL_NODE_DEBUG) << "failed to download state " << block_id_ << " from " << download_from_ << ": " << reason;
} else {
VLOG(FULL_NODE_NOTICE) << "failed to download state " << block_id_ << " from " << download_from_ << ": "
<< reason;
@ -115,6 +115,7 @@ void DownloadState::got_block_handle(BlockHandle handle) {
void DownloadState::got_node_to_download(adnl::AdnlNodeIdShort node) {
download_from_ = node;
LOG(INFO) << "downloading state " << block_id_ << " from " << download_from_;
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::BufferSlice> R) mutable {
if (R.is_error()) {
@ -187,6 +188,10 @@ void DownloadState::got_block_state_part(td::BufferSlice data, td::uint32 reques
sum_ += data.size();
parts_.push_back(std::move(data));
if (sum_ % (1 << 22) == 0) {
LOG(DEBUG) << "downloading state " << block_id_ << ": total=" << sum_;
}
if (last_part) {
td::BufferSlice res{td::narrow_cast<std::size_t>(sum_)};
auto S = res.as_slice();
@ -224,6 +229,7 @@ void DownloadState::got_block_state_part(td::BufferSlice data, td::uint32 reques
void DownloadState::got_block_state(td::BufferSlice data) {
state_ = std::move(data);
LOG(INFO) << "finished downloading state " << block_id_ << ": total=" << sum_;
finish_query();
}