Config patch change detection. (#211)

* Applying patch file changes to hpcore runtime after patch file change detection.
* Removing unl sync functionality.
* Removing subjecting unl changeset to consensus.
This commit is contained in:
Savinda Senevirathne
2021-01-06 20:02:14 +05:30
committed by GitHub
parent c87ae6693d
commit bed8205ca8
22 changed files with 90 additions and 1033 deletions

View File

@@ -57,33 +57,4 @@ namespace msg::controlmsg::json
return 0;
}
/**
* Extracts unl additions and removals from the json document.
* Format:
* {
* "type": "unl_changeset",
* "add": ["pk1","pk2",...]
* "remove": ["pk1","pk2",...]
* }
*/
int extract_unl_changeset(std::set<std::string> &additions, std::set<std::string> &removals, const jsoncons::json &d)
{
extract_string_set(additions, d, FLD_ADD);
extract_string_set(removals, d, FLD_REMOVE);
return 0;
}
void extract_string_set(std::set<std::string> &vec, const jsoncons::json &d, const char *field_name)
{
if (!d.contains(field_name) || !d[field_name].is_array())
return;
for (const auto &pkhex : d[field_name].array_range())
{
const std::string bin_pubkey = util::to_bin(pkhex.as<std::string_view>());
if (!bin_pubkey.empty())
vec.emplace(bin_pubkey);
}
}
} // namespace msg::controlmsg::json

View File

@@ -12,9 +12,6 @@ namespace msg::controlmsg::json
int extract_type(std::string &extracted_type, const jsoncons::json &d);
int extract_unl_changeset(std::set<std::string> &additions, std::set<std::string> &removals, const jsoncons::json &d);
void extract_string_set(std::set<std::string> &vec, const jsoncons::json &d, const char *field_name);
} // namespace msg::controlmsg::json