mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Fix sending msg queue queries
This commit is contained in:
parent
f1e62d0075
commit
8c4bc5b3f1
3 changed files with 44 additions and 41 deletions
|
@ -74,33 +74,35 @@ void CollatorNode::new_masterchain_block_notification(td::Ref<MasterchainState>
|
||||||
last_masterchain_block_ = state->get_block_id();
|
last_masterchain_block_ = state->get_block_id();
|
||||||
last_top_blocks_.clear();
|
last_top_blocks_.clear();
|
||||||
last_top_blocks_[ShardIdFull{masterchainId, shardIdAll}] = last_masterchain_block_;
|
last_top_blocks_[ShardIdFull{masterchainId, shardIdAll}] = last_masterchain_block_;
|
||||||
std::vector<ShardIdFull> next_shards;
|
if (state->get_unix_time() > (td::uint32)td::Clocks::system() - 20) {
|
||||||
if (can_collate_shard(ShardIdFull(masterchainId))) {
|
std::vector<ShardIdFull> next_shards;
|
||||||
next_shards.push_back(ShardIdFull(masterchainId));
|
if (can_collate_shard(ShardIdFull(masterchainId))) {
|
||||||
}
|
next_shards.push_back(ShardIdFull(masterchainId));
|
||||||
for (const auto& desc : state->get_shards()) {
|
|
||||||
last_top_blocks_[desc->shard()] = desc->top_block_id();
|
|
||||||
ShardIdFull shard = desc->shard();
|
|
||||||
if (desc->before_split()) {
|
|
||||||
if (can_collate_shard(shard_child(shard, true))) {
|
|
||||||
next_shards.push_back(shard_child(shard, true));
|
|
||||||
}
|
|
||||||
if (can_collate_shard(shard_child(shard, false))) {
|
|
||||||
next_shards.push_back(shard_child(shard, false));
|
|
||||||
}
|
|
||||||
} else if (desc->before_merge()) {
|
|
||||||
if (is_left_child(shard) && can_collate_shard(shard_parent(shard))) {
|
|
||||||
next_shards.push_back(shard_parent(shard));
|
|
||||||
}
|
|
||||||
} else if (can_collate_shard(shard)) {
|
|
||||||
next_shards.push_back(shard);
|
|
||||||
}
|
}
|
||||||
}
|
for (const auto& desc : state->get_shards()) {
|
||||||
for (const ShardIdFull& shard : next_shards) {
|
last_top_blocks_[desc->shard()] = desc->top_block_id();
|
||||||
for (const auto& neighbor : last_top_blocks_) {
|
ShardIdFull shard = desc->shard();
|
||||||
if (neighbor.first != shard && block::ShardConfig::is_neighbor(shard, neighbor.first)) {
|
if (desc->before_split()) {
|
||||||
td::actor::send_closure(manager_, &ValidatorManager::wait_out_msg_queue_proof, neighbor.second, shard, 0,
|
if (can_collate_shard(shard_child(shard, true))) {
|
||||||
td::Timestamp::in(10.0), [](td::Ref<OutMsgQueueProof>) {});
|
next_shards.push_back(shard_child(shard, true));
|
||||||
|
}
|
||||||
|
if (can_collate_shard(shard_child(shard, false))) {
|
||||||
|
next_shards.push_back(shard_child(shard, false));
|
||||||
|
}
|
||||||
|
} else if (desc->before_merge()) {
|
||||||
|
if (is_left_child(shard) && can_collate_shard(shard_parent(shard))) {
|
||||||
|
next_shards.push_back(shard_parent(shard));
|
||||||
|
}
|
||||||
|
} else if (can_collate_shard(shard)) {
|
||||||
|
next_shards.push_back(shard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const ShardIdFull& shard : next_shards) {
|
||||||
|
for (const auto& neighbor : last_top_blocks_) {
|
||||||
|
if (neighbor.first != shard && block::ShardConfig::is_neighbor(shard, neighbor.first)) {
|
||||||
|
td::actor::send_closure(manager_, &ValidatorManager::wait_out_msg_queue_proof, neighbor.second, shard, 0,
|
||||||
|
td::Timestamp::in(10.0), [](td::Ref<OutMsgQueueProof>) {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,20 +280,20 @@ void WaitOutMsgQueueProof::run_local_cont() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaitOutMsgQueueProof::run_net() {
|
void WaitOutMsgQueueProof::run_net() {
|
||||||
auto P =
|
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), block_id = block_id_,
|
||||||
td::PromiseCreator::lambda([SelfId = actor_id(this), block_id = block_id_](td::Result<Ref<OutMsgQueueProof>> R) {
|
retry_after = td::Timestamp::in(0.5)](td::Result<Ref<OutMsgQueueProof>> R) {
|
||||||
if (R.is_error()) {
|
if (R.is_error()) {
|
||||||
if (R.error().code() == ErrorCode::notready) {
|
if (R.error().code() == ErrorCode::notready) {
|
||||||
LOG(DEBUG) << "failed to get msg queue for " << block_id.to_str() << " from net: " << R.move_as_error();
|
LOG(DEBUG) << "failed to get msg queue for " << block_id.to_str() << " from net: " << R.move_as_error();
|
||||||
} else {
|
} else {
|
||||||
LOG(WARNING) << "failed to get msg queue for " << block_id.to_str() << " from net: " << R.move_as_error();
|
LOG(WARNING) << "failed to get msg queue for " << block_id.to_str() << " from net: " << R.move_as_error();
|
||||||
}
|
}
|
||||||
delay_action([SelfId]() mutable { td::actor::send_closure(SelfId, &WaitOutMsgQueueProof::run_net); },
|
delay_action([SelfId]() mutable { td::actor::send_closure(SelfId, &WaitOutMsgQueueProof::run_net); },
|
||||||
td::Timestamp::in(0.1));
|
retry_after);
|
||||||
} else {
|
} else {
|
||||||
td::actor::send_closure(SelfId, &WaitOutMsgQueueProof::finish_query, R.move_as_ok());
|
td::actor::send_closure(SelfId, &WaitOutMsgQueueProof::finish_query, R.move_as_ok());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
td::actor::send_closure(manager_, &ValidatorManager::send_get_out_msg_queue_proof_request, block_id_, dst_shard_,
|
td::actor::send_closure(manager_, &ValidatorManager::send_get_out_msg_queue_proof_request, block_id_, dst_shard_,
|
||||||
limits_, priority_, std::move(P));
|
limits_, priority_, std::move(P));
|
||||||
|
|
|
@ -1839,7 +1839,8 @@ void ValidatorManagerImpl::new_masterchain_block() {
|
||||||
for (auto &c : collator_nodes_) {
|
for (auto &c : collator_nodes_) {
|
||||||
td::actor::send_closure(c.second.actor, &CollatorNode::new_masterchain_block_notification, last_masterchain_state_);
|
td::actor::send_closure(c.second.actor, &CollatorNode::new_masterchain_block_notification, last_masterchain_state_);
|
||||||
}
|
}
|
||||||
if (opts_->validator_mode() == ValidatorManagerOptions::validator_lite_shards && validating_masterchain()) {
|
if (opts_->validator_mode() == ValidatorManagerOptions::validator_lite_shards && validating_masterchain() &&
|
||||||
|
last_masterchain_state_->get_unix_time() > (td::uint32)td::Clocks::system() - 20) {
|
||||||
// Prepare neighboours' queues for collating masterchain
|
// Prepare neighboours' queues for collating masterchain
|
||||||
for (const auto &desc : last_masterchain_state_->get_shards()) {
|
for (const auto &desc : last_masterchain_state_->get_shards()) {
|
||||||
wait_out_msg_queue_proof(desc->top_block_id(), ShardIdFull(masterchainId), 0, td::Timestamp::in(10.0),
|
wait_out_msg_queue_proof(desc->top_block_id(), ShardIdFull(masterchainId), 0, td::Timestamp::in(10.0),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue