mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Improve block broadcasts
This commit is contained in:
parent
4c8d25ac1b
commit
0e7374610d
20 changed files with 125 additions and 278 deletions
|
@ -492,7 +492,7 @@ void ValidatorManagerImpl::new_ihr_message(td::BufferSlice data) {
|
|||
}
|
||||
|
||||
void ValidatorManagerImpl::new_shard_block(BlockIdExt block_id, CatchainSeqno cc_seqno, td::BufferSlice data) {
|
||||
if (!is_validator() && !is_shard_collator(block_id.shard_full())) {
|
||||
if (!is_validator() && !is_shard_collator(block_id.shard_full()) && !cached_block_candidates_.count(block_id)) {
|
||||
return;
|
||||
}
|
||||
if (!last_masterchain_block_handle_) {
|
||||
|
@ -2120,7 +2120,7 @@ void ValidatorManagerImpl::update_shard_overlays() {
|
|||
shards_to_monitor.insert(ShardIdFull{wc, shardIdAll});
|
||||
}
|
||||
}
|
||||
callback_->on_new_masterchain_block(last_masterchain_state_, std::move(shards_to_monitor), extra_active_shards_);
|
||||
callback_->on_new_masterchain_block(last_masterchain_state_, std::move(shards_to_monitor));
|
||||
}
|
||||
|
||||
void ValidatorManagerImpl::update_shards() {
|
||||
|
@ -2138,7 +2138,6 @@ void ValidatorManagerImpl::update_shards() {
|
|||
opts.proto_version = std::max<td::uint32>(opts.proto_version, 1);
|
||||
}
|
||||
auto opts_hash = opts.get_hash();
|
||||
extra_active_shards_.clear();
|
||||
|
||||
std::map<ShardIdFull, std::vector<BlockIdExt>> new_shards;
|
||||
std::set<ShardIdFull> future_shards;
|
||||
|
@ -2193,11 +2192,6 @@ void ValidatorManagerImpl::update_shards() {
|
|||
default:
|
||||
LOG(FATAL) << "state=" << static_cast<td::uint32>(v->fsm_state());
|
||||
}
|
||||
cleanup_last_validated_blocks(v->top_block_id().id);
|
||||
}
|
||||
|
||||
for (const auto& s : last_validated_blocks_) {
|
||||
extra_active_shards_.insert(s.first);
|
||||
}
|
||||
|
||||
new_shards.emplace(ShardIdFull{masterchainId, shardIdAll}, std::vector<BlockIdExt>{last_masterchain_block_id_});
|
||||
|
@ -2270,7 +2264,6 @@ void ValidatorManagerImpl::update_shards() {
|
|||
auto validator_id = get_validator(shard, val_set);
|
||||
|
||||
if (!validator_id.is_zero()) {
|
||||
extra_active_shards_.insert(shard);
|
||||
auto val_group_id = get_validator_set_id(shard, val_set, opts_hash, key_seqno, opts);
|
||||
|
||||
if (force_recover) {
|
||||
|
@ -2366,24 +2359,6 @@ void ValidatorManagerImpl::update_shards() {
|
|||
}
|
||||
}
|
||||
|
||||
void ValidatorManagerImpl::cleanup_last_validated_blocks(BlockId new_block) {
|
||||
auto process_shard = [&, this](ShardIdFull shard) {
|
||||
auto it = last_validated_blocks_.find(shard);
|
||||
if (it != last_validated_blocks_.end() && it->second < new_block.seqno) {
|
||||
last_validated_blocks_.erase(it);
|
||||
}
|
||||
};
|
||||
ShardIdFull shard = new_block.shard_full();
|
||||
process_shard(shard);
|
||||
if (shard.pfx_len() > 0) {
|
||||
process_shard(shard_parent(shard));
|
||||
}
|
||||
if (shard.pfx_len() < max_shard_pfx_len) {
|
||||
process_shard(shard_child(shard, true));
|
||||
process_shard(shard_child(shard, false));
|
||||
}
|
||||
}
|
||||
|
||||
void ValidatorManagerImpl::written_destroyed_validator_sessions(std::vector<td::actor::ActorId<ValidatorGroup>> list) {
|
||||
for (auto &v : list) {
|
||||
td::actor::send_closure(v, &ValidatorGroup::destroy);
|
||||
|
@ -2463,7 +2438,7 @@ td::actor::ActorOwn<ValidatorGroup> ValidatorManagerImpl::create_validator_group
|
|||
auto validator_id = get_validator(shard, validator_set);
|
||||
CHECK(!validator_id.is_zero());
|
||||
auto G = td::actor::create_actor<ValidatorGroup>(
|
||||
"validatorgroup", shard, validator_id, session_id, validator_set,
|
||||
PSTRING() << "valgroup" << shard.to_str(), shard, validator_id, session_id, validator_set,
|
||||
last_masterchain_state_->get_collator_config(true), opts, keyring_, adnl_, rldp_, overlays_, db_root_,
|
||||
actor_id(this), init_session, opts_->check_unsafe_resync_allowed(validator_set->get_catchain_seqno()), opts_,
|
||||
opts_->need_monitor(shard, last_masterchain_state_));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue