mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Refresh consensus context when a roundtime change happens. (#267)
This commit is contained in:
committed by
GitHub
parent
00a3da9a2b
commit
b6a69e5824
@@ -226,13 +226,13 @@ namespace consensus
|
||||
{
|
||||
conf::change_role(conf::ROLE::OBSERVER);
|
||||
|
||||
if (is_state_desync)
|
||||
sc::contract_sync_worker.set_target_push_front(hpfs::sync_target{"state", majority_state_hash, sc::STATE_DIR_PATH, hpfs::BACKLOG_ITEM_TYPE::DIR});
|
||||
|
||||
// Patch file sync is prioritized, Therefore it is set in the front of the sync target list.
|
||||
if (is_patch_desync)
|
||||
sc::contract_sync_worker.set_target_push_front(hpfs::sync_target{"patch", majority_patch_hash, sc::PATCH_FILE_PATH, hpfs::BACKLOG_ITEM_TYPE::FILE});
|
||||
|
||||
if (is_state_desync)
|
||||
sc::contract_sync_worker.set_target_push_back(hpfs::sync_target{"state", majority_state_hash, sc::STATE_DIR_PATH, hpfs::BACKLOG_ITEM_TYPE::DIR});
|
||||
|
||||
// If ledger blob shard is desync, We first request the latest blob shard.
|
||||
if (is_last_blob_shard_desync)
|
||||
{
|
||||
@@ -348,7 +348,7 @@ namespace consensus
|
||||
|
||||
const uint64_t now = util::get_epoch_milliseconds();
|
||||
|
||||
// Rrounds are discreet windows of roundtime.
|
||||
// Rounds are discreet windows of roundtime.
|
||||
|
||||
if (ctx.stage == 0)
|
||||
{
|
||||
@@ -1094,6 +1094,8 @@ namespace consensus
|
||||
else
|
||||
{
|
||||
unl::update_unl_changes_from_patch();
|
||||
// Refresh values in consensus context to match newly synced roundtime from patch file.
|
||||
refresh_roundtime(false);
|
||||
is_patch_update_pending = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,11 @@ namespace hpfs
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove any previous sync targets for the same target vpath.
|
||||
target_list.remove_if([&target](const hpfs::sync_target &element) {
|
||||
return element.vpath == target.vpath;
|
||||
});
|
||||
|
||||
target_list.push_front(target);
|
||||
is_syncing = true;
|
||||
std::unique_lock lock(current_target_mutex);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "../unl.hpp"
|
||||
#include "../hpfs/hpfs_mount.hpp"
|
||||
#include "contract_mount.hpp"
|
||||
#include "../consensus.hpp"
|
||||
|
||||
namespace sc
|
||||
{
|
||||
@@ -19,6 +20,7 @@ namespace sc
|
||||
else
|
||||
{
|
||||
unl::update_unl_changes_from_patch();
|
||||
consensus::refresh_roundtime(false);
|
||||
|
||||
// Update global hash tracker with the new patch file hash.
|
||||
fs_mount->set_parent_hash(synced_target.vpath, synced_target.hash);
|
||||
|
||||
Reference in New Issue
Block a user