Introduced UNL update control message. (#169)

This commit is contained in:
Ravin Perera
2020-11-26 22:26:12 +05:30
committed by GitHub
parent 993eb11971
commit d476f787a7
20 changed files with 304 additions and 76 deletions

View File

@@ -2,6 +2,7 @@
#include "conf.hpp"
#include "crypto.hpp"
#include "util/util.hpp"
#include "unl.hpp"
namespace conf
{
@@ -29,9 +30,6 @@ namespace conf
if (validate_contract_dir_paths() != 0 || load_config() != 0 || validate_config() != 0)
return -1;
// Append self pubkey to unl list.
cfg.unl.emplace(cfg.pubkey);
return 0;
}
@@ -216,6 +214,9 @@ namespace conf
cfg.pubkeyhex = d["pubkeyhex"].as<std::string>();
cfg.seckeyhex = d["seckeyhex"].as<std::string>();
// Convert the hex keys to binary and keep for later use.
if (hexpair_to_bin() != 0)
return -1;
cfg.binary = d["binary"].as<std::string>();
cfg.binargs = d["binargs"].as<std::string>();
@@ -278,9 +279,14 @@ namespace conf
std::cerr << "Error decoding unl list.\n";
return -1;
}
cfg.unl.emplace(bin_pubkey);
cfg.unl.push_back(bin_pubkey);
}
cfg.unl.push_back(cfg.pubkey); // Add self pubkey.
unl::add(cfg.unl);
// Remove self pubkey after sending to unl list. This is so that it doesn't get saved in the config in "rekey" mode.
cfg.unl.pop_back();
cfg.peerport = d["peerport"].as<uint16_t>();
cfg.pubport = d["pubport"].as<uint16_t>();
cfg.roundtime = d["roundtime"].as<uint16_t>();
@@ -318,10 +324,6 @@ namespace conf
for (auto &v : d["loggers"].array_range())
cfg.loggers.emplace(v.as<std::string>());
// Convert the hex keys to binary and keep for later use.
if (hexpair_to_bin() != 0)
return -1;
return 0;
}
/**