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

@@ -10,6 +10,7 @@
#include "../util/h32.hpp"
#include "hpfs_sync.hpp"
#include "../sc.hpp"
#include "../unl.hpp"
namespace hpfs_sync
{
@@ -132,6 +133,22 @@ namespace hpfs_sync
{
ctx.target_patch_hash = util::h32_empty;
LOG_INFO << "hpfs sync: Target patch state achieved: " << new_state;
// Appling new patch file changes to hpcore runtime.
if (conf::validate_and_apply_patch_config(conf::cfg.contract, conf::ctx.hpfs_rw_dir) == -1)
{
LOG_ERROR << "Appling patch file changes after sync failed";
}
else
{
unl::update_unl_changes_from_patch();
// Update global hash tracker with the new patch file hash.
util::h32 updated_patch_hash;
hpfs::get_hash(updated_patch_hash, conf::ctx.hpfs_rw_dir, conf::PATCH_FILE_PATH);
hpfs::ctx.set_hash(hpfs::HPFS_PARENT_COMPONENTS::PATCH, updated_patch_hash);
}
if (ctx.target_state_hash == hpfs::ctx.get_hash(hpfs::HPFS_PARENT_COMPONENTS::STATE))
break;