mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Merge branch 'testnet' into block-generation
This commit is contained in:
commit
172c16ca2e
43 changed files with 545 additions and 248 deletions
|
@ -1429,6 +1429,12 @@ td::Status ValidatorEngine::load_global_config() {
|
|||
validator_options_.write().set_archive_preload_period(archive_preload_period_);
|
||||
validator_options_.write().set_disable_rocksdb_stats(disable_rocksdb_stats_);
|
||||
validator_options_.write().set_nonfinal_ls_queries_enabled(nonfinal_ls_queries_enabled_);
|
||||
if (celldb_cache_size_) {
|
||||
validator_options_.write().set_celldb_cache_size(celldb_cache_size_.value());
|
||||
}
|
||||
if (catchain_max_block_delay_) {
|
||||
validator_options_.write().set_catchain_max_block_delay(catchain_max_block_delay_.value());
|
||||
}
|
||||
|
||||
std::vector<ton::BlockIdExt> h;
|
||||
for (auto &x : conf.validator_->hardforks_) {
|
||||
|
@ -2466,16 +2472,9 @@ void ValidatorEngine::load_custom_overlays_config() {
|
|||
}
|
||||
|
||||
for (auto &overlay : custom_overlays_config_->overlays_) {
|
||||
std::vector<ton::adnl::AdnlNodeIdShort> nodes;
|
||||
std::map<ton::adnl::AdnlNodeIdShort, int> senders;
|
||||
for (const auto &node : overlay->nodes_) {
|
||||
nodes.emplace_back(node->adnl_id_);
|
||||
if (node->msg_sender_) {
|
||||
senders[ton::adnl::AdnlNodeIdShort{node->adnl_id_}] = node->msg_sender_priority_;
|
||||
}
|
||||
}
|
||||
td::actor::send_closure(full_node_, &ton::validator::fullnode::FullNode::add_ext_msg_overlay, std::move(nodes),
|
||||
std::move(senders), overlay->name_, [](td::Result<td::Unit> R) { R.ensure(); });
|
||||
td::actor::send_closure(full_node_, &ton::validator::fullnode::FullNode::add_custom_overlay,
|
||||
ton::validator::fullnode::CustomOverlayParams::fetch(*overlay),
|
||||
[](td::Result<td::Unit> R) { R.ensure(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3680,11 +3679,10 @@ void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_addCustom
|
|||
senders[ton::adnl::AdnlNodeIdShort{node->adnl_id_}] = node->msg_sender_priority_;
|
||||
}
|
||||
}
|
||||
std::string name = overlay->name_;
|
||||
auto params = ton::validator::fullnode::CustomOverlayParams::fetch(*query.overlay_);
|
||||
td::actor::send_closure(
|
||||
full_node_, &ton::validator::fullnode::FullNode::add_ext_msg_overlay, std::move(nodes), std::move(senders),
|
||||
std::move(name),
|
||||
[SelfId = actor_id(this), overlay = std::move(overlay),
|
||||
full_node_, &ton::validator::fullnode::FullNode::add_custom_overlay, std::move(params),
|
||||
[SelfId = actor_id(this), overlay = std::move(query.overlay_),
|
||||
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()));
|
||||
|
@ -3714,7 +3712,7 @@ void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_delCustom
|
|||
return;
|
||||
}
|
||||
td::actor::send_closure(
|
||||
full_node_, &ton::validator::fullnode::FullNode::del_ext_msg_overlay, query.name_,
|
||||
full_node_, &ton::validator::fullnode::FullNode::del_custom_overlay, query.name_,
|
||||
[SelfId = actor_id(this), name = query.name_, 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()));
|
||||
|
@ -4286,6 +4284,27 @@ int main(int argc, char *argv[]) {
|
|||
p.add_option('\0', "nonfinal-ls", "enable special LS queries to non-finalized blocks", [&]() {
|
||||
acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_nonfinal_ls_queries_enabled); });
|
||||
});
|
||||
p.add_checked_option(
|
||||
'\0', "celldb-cache-size",
|
||||
"block cache size for RocksDb in CellDb, in bytes (default: 1G cache shared by archive DB)",
|
||||
[&](td::Slice s) -> td::Status {
|
||||
TRY_RESULT(v, td::to_integer_safe<td::uint64>(s));
|
||||
if (v == 0) {
|
||||
return td::Status::Error("celldb-cache-size should be positive");
|
||||
}
|
||||
acts.push_back([&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_cache_size, v); });
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_checked_option(
|
||||
'\0', "catchain-max-block-delay", "delay before creating a new catchain block, in seconds (default: 0.5)",
|
||||
[&](td::Slice s) -> td::Status {
|
||||
auto v = td::to_double(s);
|
||||
if (v < 0) {
|
||||
return td::Status::Error("catchain-max-block-delay should be non-negative");
|
||||
}
|
||||
acts.push_back([&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_catchain_max_block_delay, 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