1
0
Fork 0
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:
SpyCheese 2023-07-26 12:21:19 +03:00
parent f1e62d0075
commit 8c4bc5b3f1
3 changed files with 44 additions and 41 deletions

View file

@ -74,6 +74,7 @@ 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_;
if (state->get_unix_time() > (td::uint32)td::Clocks::system() - 20) {
std::vector<ShardIdFull> next_shards; std::vector<ShardIdFull> next_shards;
if (can_collate_shard(ShardIdFull(masterchainId))) { if (can_collate_shard(ShardIdFull(masterchainId))) {
next_shards.push_back(ShardIdFull(masterchainId)); next_shards.push_back(ShardIdFull(masterchainId));
@ -104,6 +105,7 @@ void CollatorNode::new_masterchain_block_notification(td::Ref<MasterchainState>
} }
} }
} }
}
if (validators_.empty() || state->is_key_state()) { if (validators_.empty() || state->is_key_state()) {
validators_.clear(); validators_.clear();
for (int next : {-1, 0, 1}) { for (int next : {-1, 0, 1}) {

View file

@ -280,8 +280,8 @@ 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();
@ -289,7 +289,7 @@ void WaitOutMsgQueueProof::run_net() {
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());
} }

View file

@ -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),