Skip to content

Commit c4a5f99

Browse files
committed
Try to fix snap sync.
1 parent 6e884bd commit c4a5f99

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

crates/networking/p2p/sync_manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl SyncManager {
9797
}
9898

9999
/// Updates the last fcu head. This may be used on the next sync cycle if needed
100-
fn set_head(&self, fcu_head: H256) {
100+
pub fn set_head(&self, fcu_head: H256) {
101101
if let Ok(mut latest_fcu_head) = self.last_fcu_head.try_lock() {
102102
*latest_fcu_head = fcu_head;
103103
} else {
@@ -106,7 +106,7 @@ impl SyncManager {
106106
}
107107

108108
/// Returns true is the syncer is active
109-
fn is_active(&self) -> bool {
109+
pub fn is_active(&self) -> bool {
110110
self.syncer.try_lock().is_err()
111111
}
112112

crates/networking/rpc/engine/fork_choice.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,8 @@ async fn handle_forkchoice(
210210
));
211211
}
212212

213-
if context.syncer.sync_mode() == SyncMode::Snap {
214-
context
215-
.syncer
216-
.sync_to_head(fork_choice_state.head_block_hash);
213+
if context.syncer.sync_mode() == SyncMode::Snap && context.syncer.is_active() {
214+
context.syncer.set_head(fork_choice_state.head_block_hash);
217215
return Ok((None, PayloadStatus::syncing().into()));
218216
}
219217

0 commit comments

Comments
 (0)