Skip to content

Commit a70bdfb

Browse files
committed
Disable optimistic generation in masterchain
1 parent c7b6c25 commit a70bdfb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

validator-session/validator-session.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,7 @@ void ValidatorSessionImpl::generate_block_optimistic(td::uint32 cur_round,
14131413
block->data_.clone(), block->root_hash_, stat->block_id.file_hash,
14141414
[=, SelfId = actor_id(this)](td::Result<GeneratedCandidate> R) {
14151415
if (R.is_error()) {
1416+
LOG(DEBUG) << "Optimistic generation error: " << R.move_as_error();
14161417
return;
14171418
}
14181419
td::actor::send_closure(SelfId,

validator/validator-group.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,19 @@ void ValidatorGroup::generate_block_optimistic(validatorsession::BlockSourceInfo
301301
td::BufferSlice prev_block, RootHash prev_root_hash,
302302
FileHash prev_file_hash, td::Promise<GeneratedCandidate> promise) {
303303
if (destroying_) {
304+
promise.set_error(td::Status::Error("validator session finished"));
305+
return;
306+
}
307+
if (shard_.is_masterchain()) {
308+
promise.set_error(td::Status::Error("no optimistic generation in masterchain"));
304309
return;
305310
}
306311
if (last_known_round_id_ + 1 != source_info.priority.round) {
312+
promise.set_error(td::Status::Error("too old round"));
307313
return;
308314
}
309315
if (optimistic_generation_ && optimistic_generation_->round >= source_info.priority.round) {
316+
promise.set_error(td::Status::Error("optimistic generation already in progress"));
310317
return;
311318
}
312319
BlockIdExt block_id{create_next_block_id_simple(), prev_root_hash, prev_file_hash};

0 commit comments

Comments
 (0)