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

emergency update

This commit is contained in:
ton 2020-03-24 03:32:16 +04:00
parent 5d846e0aaf
commit 9f351fc29f
87 changed files with 2486 additions and 655 deletions

View file

@ -79,8 +79,8 @@ void ApplyBlock::got_block_handle(BlockHandle handle) {
}
if (handle_->is_applied()) {
auto P = td::PromiseCreator::lambda(
[ SelfId = actor_id(this), seqno = handle_->id().id.seqno ](td::Result<BlockIdExt> R) {
auto P =
td::PromiseCreator::lambda([SelfId = actor_id(this), seqno = handle_->id().id.seqno](td::Result<BlockIdExt> R) {
R.ensure();
auto h = R.move_as_ok();
if (h.id.seqno < seqno) {
@ -119,15 +119,14 @@ void ApplyBlock::got_block_handle(BlockHandle handle) {
td::actor::send_closure(manager_, &ValidatorManager::set_block_data, handle_, block_, std::move(P));
} else {
auto P =
td::PromiseCreator::lambda([ SelfId = actor_id(this), handle = handle_ ](td::Result<td::Ref<BlockData>> R) {
CHECK(handle->received());
if (R.is_error()) {
td::actor::send_closure(SelfId, &ApplyBlock::abort_query, R.move_as_error());
} else {
td::actor::send_closure(SelfId, &ApplyBlock::written_block_data);
}
});
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), handle = handle_](td::Result<td::Ref<BlockData>> R) {
CHECK(handle->received());
if (R.is_error()) {
td::actor::send_closure(SelfId, &ApplyBlock::abort_query, R.move_as_error());
} else {
td::actor::send_closure(SelfId, &ApplyBlock::written_block_data);
}
});
td::actor::send_closure(manager_, &ValidatorManager::wait_block_data, handle_, apply_block_priority(), timeout_,
std::move(P));
@ -136,19 +135,25 @@ void ApplyBlock::got_block_handle(BlockHandle handle) {
void ApplyBlock::written_block_data() {
VLOG(VALIDATOR_DEBUG) << "apply block: written block data for " << id_;
if (handle_->id().is_masterchain() && !handle_->inited_proof()) {
abort_query(td::Status::Error(ErrorCode::notready, "proof is absent"));
return;
if (!handle_->id().seqno()) {
CHECK(handle_->inited_split_after());
CHECK(handle_->inited_state_root_hash());
CHECK(handle_->inited_logical_time());
} else {
if (handle_->id().is_masterchain() && !handle_->inited_proof()) {
abort_query(td::Status::Error(ErrorCode::notready, "proof is absent"));
return;
}
if (!handle_->id().is_masterchain() && !handle_->inited_proof_link()) {
abort_query(td::Status::Error(ErrorCode::notready, "proof link is absent"));
return;
}
CHECK(handle_->inited_merge_before());
CHECK(handle_->inited_split_after());
CHECK(handle_->inited_prev());
CHECK(handle_->inited_state_root_hash());
CHECK(handle_->inited_logical_time());
}
if (!handle_->id().is_masterchain() && !handle_->inited_proof_link()) {
abort_query(td::Status::Error(ErrorCode::notready, "proof link is absent"));
return;
}
CHECK(handle_->inited_merge_before());
CHECK(handle_->inited_split_after());
CHECK(handle_->inited_prev());
CHECK(handle_->inited_state_root_hash());
CHECK(handle_->inited_logical_time());
if (handle_->is_applied() && handle_->processed()) {
finish_query();
} else {