mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Reload validator options when needed
This commit is contained in:
parent
011e97f53c
commit
be2169e523
10 changed files with 47 additions and 4 deletions
|
@ -1404,7 +1404,7 @@ td::Status ValidatorEngine::load_global_config() {
|
|||
return td::Status::OK();
|
||||
}
|
||||
|
||||
void ValidatorEngine::init_validator_options() {
|
||||
void ValidatorEngine::set_shard_check_function() {
|
||||
if (!not_all_shards_) {
|
||||
validator_options_.write().set_shard_check_function([](ton::ShardIdFull shard) -> bool { return true; });
|
||||
} else {
|
||||
|
@ -1711,7 +1711,7 @@ void ValidatorEngine::got_key(ton::PublicKey key) {
|
|||
}
|
||||
|
||||
void ValidatorEngine::start() {
|
||||
init_validator_options();
|
||||
set_shard_check_function();
|
||||
read_config_ = true;
|
||||
start_adnl();
|
||||
}
|
||||
|
@ -3412,7 +3412,10 @@ void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_addCollat
|
|||
promise.set_value(ton::serialize_tl_object(ton::create_tl_object<ton::ton_api::engine_validator_success>(), true));
|
||||
return;
|
||||
}
|
||||
set_shard_check_function();
|
||||
if (!validator_manager_.empty()) {
|
||||
td::actor::send_closure(validator_manager_, &ton::validator::ValidatorManagerInterface::update_options,
|
||||
validator_options_);
|
||||
td::actor::send_closure(validator_manager_, &ton::validator::ValidatorManagerInterface::add_collator,
|
||||
ton::adnl::AdnlNodeIdShort(id), shard);
|
||||
}
|
||||
|
@ -3443,7 +3446,18 @@ void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_addShard
|
|||
promise.set_value(create_control_query_error(R.move_as_error()));
|
||||
return;
|
||||
}
|
||||
promise.set_value(ton::serialize_tl_object(ton::create_tl_object<ton::ton_api::engine_validator_success>(), true));
|
||||
set_shard_check_function();
|
||||
if (!validator_manager_.empty()) {
|
||||
td::actor::send_closure(validator_manager_, &ton::validator::ValidatorManagerInterface::update_options,
|
||||
validator_options_);
|
||||
}
|
||||
write_config([promise = std::move(promise)](td::Result<td::Unit> R) mutable {
|
||||
if (R.is_error()) {
|
||||
promise.set_value(create_control_query_error(R.move_as_error()));
|
||||
} else {
|
||||
promise.set_value(ton::serialize_tl_object(ton::create_tl_object<ton::ton_api::engine_validator_success>(), true));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void ValidatorEngine::process_control_query(td::uint16 port, ton::adnl::AdnlNodeIdShort src,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue