mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Send validator telemetry to the private overlay (#1325)
* Send validator telemetry to the private overlay * Improve rotating neighbours in overlays
This commit is contained in:
parent
52b010ff34
commit
061c82f89c
30 changed files with 426 additions and 13 deletions
|
@ -1624,6 +1624,11 @@ void ValidatorManagerImpl::send_block_broadcast(BlockBroadcast broadcast, int mo
|
|||
callback_->send_broadcast(std::move(broadcast), mode);
|
||||
}
|
||||
|
||||
void ValidatorManagerImpl::send_validator_telemetry(PublicKeyHash key,
|
||||
tl_object_ptr<ton_api::validator_telemetry> telemetry) {
|
||||
callback_->send_validator_telemetry(key, std::move(telemetry));
|
||||
}
|
||||
|
||||
void ValidatorManagerImpl::start_up() {
|
||||
db_ = create_db_actor(actor_id(this), db_root_, opts_);
|
||||
actor_stats_ = td::actor::create_actor<td::actor::ActorStats>("actor_stats");
|
||||
|
@ -1724,6 +1729,7 @@ void ValidatorManagerImpl::started(ValidatorManagerInitResult R) {
|
|||
if (opts_->nonfinal_ls_queries_enabled()) {
|
||||
candidates_buffer_ = td::actor::create_actor<CandidatesBuffer>("candidates-buffer", actor_id(this));
|
||||
}
|
||||
init_validator_telemetry();
|
||||
}
|
||||
|
||||
void ValidatorManagerImpl::read_gc_list(std::vector<ValidatorSessionId> list) {
|
||||
|
@ -1930,6 +1936,7 @@ void ValidatorManagerImpl::new_masterchain_block() {
|
|||
td::actor::send_closure(serializer_, &AsyncStateSerializer::update_last_known_key_block_ts,
|
||||
last_key_block_handle_->unix_time());
|
||||
}
|
||||
init_validator_telemetry();
|
||||
}
|
||||
|
||||
update_shards();
|
||||
|
@ -3286,6 +3293,41 @@ void ValidatorManagerImpl::CheckedExtMsgCounter::before_query() {
|
|||
}
|
||||
}
|
||||
|
||||
void ValidatorManagerImpl::init_validator_telemetry() {
|
||||
if (last_masterchain_state_.is_null()) {
|
||||
return;
|
||||
}
|
||||
td::Ref<ValidatorSet> validator_set = last_masterchain_state_->get_total_validator_set(0);
|
||||
if (validator_set.is_null()) {
|
||||
validator_telemetry_.clear();
|
||||
return;
|
||||
}
|
||||
std::set<PublicKeyHash> processed;
|
||||
for (auto& key : temp_keys_) {
|
||||
if (const ValidatorDescr* desc = validator_set->get_validator(key.bits256_value())) {
|
||||
processed.insert(key);
|
||||
adnl::AdnlNodeIdShort adnl_id;
|
||||
if (desc->addr.is_zero()) {
|
||||
adnl_id = adnl::AdnlNodeIdShort{ValidatorFullId{desc->key}.compute_short_id()};
|
||||
} else {
|
||||
adnl_id = adnl::AdnlNodeIdShort{desc->addr};
|
||||
}
|
||||
auto& telemetry = validator_telemetry_[key];
|
||||
if (telemetry.empty()) {
|
||||
telemetry = td::actor::create_actor<ValidatorTelemetry>(
|
||||
"telemetry", key, adnl_id, opts_->zero_block_id().file_hash, actor_id(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto it = validator_telemetry_.begin(); it != validator_telemetry_.end();) {
|
||||
if (processed.contains(it->first)) {
|
||||
++it;
|
||||
} else {
|
||||
it = validator_telemetry_.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace validator
|
||||
|
||||
} // namespace ton
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue