mirror of
				https://github.com/ton-blockchain/ton
				synced 2025-03-09 15:40:10 +00:00 
			
		
		
		
	Experimental flags for speeding up broadcasts
This commit is contained in:
		
							parent
							
								
									04f2bc1360
								
							
						
					
					
						commit
						8a08bf67a2
					
				
					 19 changed files with 131 additions and 46 deletions
				
			
		| 
						 | 
				
			
			@ -1504,6 +1504,7 @@ td::Status ValidatorEngine::load_global_config() {
 | 
			
		|||
  }
 | 
			
		||||
  validator_options_.write().set_hardforks(std::move(h));
 | 
			
		||||
  validator_options_.write().set_fast_state_serializer_enabled(fast_state_serializer_enabled_);
 | 
			
		||||
  validator_options_.write().set_catchain_broadcast_speed_multiplier(broadcast_speed_multiplier_catchain_);
 | 
			
		||||
 | 
			
		||||
  return td::Status::OK();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2004,9 +2005,13 @@ void ValidatorEngine::start_full_node() {
 | 
			
		|||
      R.ensure();
 | 
			
		||||
      td::actor::send_closure(SelfId, &ValidatorEngine::started_full_node);
 | 
			
		||||
    });
 | 
			
		||||
    ton::validator::fullnode::FullNodeOptions full_node_options{
 | 
			
		||||
        .config_ = config_.full_node_config,
 | 
			
		||||
        .public_broadcast_speed_multiplier_ = broadcast_speed_multiplier_public_,
 | 
			
		||||
        .private_broadcast_speed_multiplier_ = broadcast_speed_multiplier_private_};
 | 
			
		||||
    full_node_ = ton::validator::fullnode::FullNode::create(
 | 
			
		||||
        short_id, ton::adnl::AdnlNodeIdShort{config_.full_node}, validator_options_->zero_block_id().file_hash,
 | 
			
		||||
        config_.full_node_config, keyring_.get(), adnl_.get(), rldp_.get(), rldp2_.get(),
 | 
			
		||||
        full_node_options, keyring_.get(), adnl_.get(), rldp_.get(), rldp2_.get(),
 | 
			
		||||
        default_dht_node_.is_zero() ? td::actor::ActorId<ton::dht::Dht>{} : dht_nodes_[default_dht_node_].get(),
 | 
			
		||||
        overlay_manager_.get(), validator_manager_.get(), full_node_client_.get(), db_root_, std::move(P));
 | 
			
		||||
    for (auto &v : config_.validators) {
 | 
			
		||||
| 
						 | 
				
			
			@ -4562,6 +4567,42 @@ int main(int argc, char *argv[]) {
 | 
			
		|||
      "disable persistent state serializer (similar to set-state-serializer-enabled 0 in validator console)", [&]() {
 | 
			
		||||
        acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_state_serializer_disabled_flag); });
 | 
			
		||||
      });
 | 
			
		||||
  p.add_checked_option(
 | 
			
		||||
      '\0', "broadcast-speed-catchain",
 | 
			
		||||
      "multiplier for broadcast speed in catchain overlays (experimental, default is 1.0, which is ~300 KB/s)",
 | 
			
		||||
      [&](td::Slice s) -> td::Status {
 | 
			
		||||
        auto v = td::to_double(s);
 | 
			
		||||
        if (v <= 0.0) {
 | 
			
		||||
          return td::Status::Error("broadcast-speed-catchain should be positive");
 | 
			
		||||
        }
 | 
			
		||||
        acts.push_back(
 | 
			
		||||
            [&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_broadcast_speed_multiplier_catchain, v); });
 | 
			
		||||
        return td::Status::OK();
 | 
			
		||||
      });
 | 
			
		||||
  p.add_checked_option(
 | 
			
		||||
      '\0', "broadcast-speed-public",
 | 
			
		||||
      "multiplier for broadcast speed in public shard overlays (experimental, default is 1.0, which is ~300 KB/s)",
 | 
			
		||||
      [&](td::Slice s) -> td::Status {
 | 
			
		||||
        auto v = td::to_double(s);
 | 
			
		||||
        if (v <= 0.0) {
 | 
			
		||||
          return td::Status::Error("broadcast-speed-public should be positive");
 | 
			
		||||
        }
 | 
			
		||||
        acts.push_back(
 | 
			
		||||
            [&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_broadcast_speed_multiplier_public, v); });
 | 
			
		||||
        return td::Status::OK();
 | 
			
		||||
      });
 | 
			
		||||
  p.add_checked_option(
 | 
			
		||||
      '\0', "broadcast-speed-private",
 | 
			
		||||
      "multiplier for broadcast speed in private block overlays (experimental, default is 1.0, which is ~300 KB/s)",
 | 
			
		||||
      [&](td::Slice s) -> td::Status {
 | 
			
		||||
        auto v = td::to_double(s);
 | 
			
		||||
        if (v <= 0.0) {
 | 
			
		||||
          return td::Status::Error("broadcast-speed-private should be positive");
 | 
			
		||||
        }
 | 
			
		||||
        acts.push_back(
 | 
			
		||||
            [&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_broadcast_speed_multiplier_private, v); });
 | 
			
		||||
        return td::Status::OK();
 | 
			
		||||
      });
 | 
			
		||||
  auto S = p.run(argc, argv);
 | 
			
		||||
  if (S.is_error()) {
 | 
			
		||||
    LOG(ERROR) << "failed to parse options: " << S.move_as_error();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue