Skip to content

Commit

Permalink
Stricter sync status check for remote peers: use the same criteria as…
Browse files Browse the repository at this point in the history
… checking if beacon node is forward synced
  • Loading branch information
povi committed Jan 22, 2025
1 parent d556ebf commit c0678b0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion p2p/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,17 @@ impl<P: Preset> Network<P> {
let (local_finalized_root_at_remote_finalized_epoch, sync_status) =
match local.finalized_epoch.cmp(&remote.finalized_epoch) {
Ordering::Less => (None, SyncStatus::Advanced { info }),
Ordering::Equal => (Some(local.finalized_root), SyncStatus::Synced { info }),
Ordering::Equal => {
let max_empty_slots = self.controller.store_config().max_empty_slots;

let status = if remote.head_slot + max_empty_slots < local.head_slot {
SyncStatus::Behind { info }
} else {
SyncStatus::Synced { info }
};

(Some(local.finalized_root), status)
}
Ordering::Greater => {
let remote_finalized_slot = Self::start_of_epoch(remote.finalized_epoch);

Expand Down

0 comments on commit c0678b0

Please sign in to comment.