Skip to content

Commit 7860288

Browse files
pawanjay176AgeManning
authored andcommitted
Relax requirement for enr fork digest predicate (#2433)
1 parent 0589676 commit 7860288

File tree

1 file changed

+5
-1
lines changed
  • beacon_node/eth2_libp2p/src/discovery

1 file changed

+5
-1
lines changed

beacon_node/eth2_libp2p/src/discovery/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,11 @@ impl<TSpec: EthSpec> Discovery<TSpec> {
737737
};
738738
// predicate for finding nodes with a matching fork and valid tcp port
739739
let eth2_fork_predicate = move |enr: &Enr| {
740-
enr.eth2() == Ok(enr_fork_id.clone()) && (enr.tcp().is_some() || enr.tcp6().is_some())
740+
// `next_fork_epoch` and `next_fork_version` can be different so that
741+
// we can connect to peers who aren't compatible with an upcoming fork.
742+
// `fork_digest` **must** be same.
743+
enr.eth2().map(|e| e.fork_digest) == Ok(enr_fork_id.fork_digest)
744+
&& (enr.tcp().is_some() || enr.tcp6().is_some())
741745
};
742746

743747
// General predicate

0 commit comments

Comments
 (0)