1
0
Fork 0
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:
SpyCheese 2024-02-01 19:29:25 +03:00
commit f4fd3ff3be
246 changed files with 7895 additions and 5430 deletions

View file

@ -574,6 +574,12 @@ void DhtServer::load_config(td::Promise<td::Unit> promise) {
config_file_ = db_root_ + "/config.json";
}
auto conf_data_R = td::read_file(config_file_);
if (conf_data_R.is_error()) {
conf_data_R = td::read_file(temp_config_file());
if (conf_data_R.is_ok()) {
td::rename(temp_config_file(), config_file_).ensure();
}
}
if (conf_data_R.is_error()) {
auto P = td::PromiseCreator::lambda(
[name = local_config_, new_name = config_file_, promise = std::move(promise)](td::Result<td::Unit> R) {
@ -622,12 +628,15 @@ void DhtServer::load_config(td::Promise<td::Unit> promise) {
void DhtServer::write_config(td::Promise<td::Unit> promise) {
auto s = td::json_encode<std::string>(td::ToJson(*config_.tl().get()), true);
auto S = td::write_file(config_file_, s);
if (S.is_ok()) {
promise.set_value(td::Unit());
} else {
auto S = td::write_file(temp_config_file(), s);
if (S.is_error()) {
td::unlink(temp_config_file()).ignore();
promise.set_error(std::move(S));
return;
}
td::unlink(config_file_).ignore();
TRY_STATUS_PROMISE(promise, td::rename(temp_config_file(), config_file_));
promise.set_value(td::Unit());
}
td::Promise<ton::PublicKey> DhtServer::get_key_promise(td::MultiPromise::InitGuard &ig) {