From 64226321b37d74397777e444589dbb826fd0db8d Mon Sep 17 00:00:00 2001 From: Pawan Dhananjay Date: Fri, 9 Jul 2021 08:18:29 +0530 Subject: [PATCH] Relax requirement for enr fork digest predicate (#2433) --- beacon_node/eth2_libp2p/src/discovery/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/beacon_node/eth2_libp2p/src/discovery/mod.rs b/beacon_node/eth2_libp2p/src/discovery/mod.rs index 18c718448..5554ba119 100644 --- a/beacon_node/eth2_libp2p/src/discovery/mod.rs +++ b/beacon_node/eth2_libp2p/src/discovery/mod.rs @@ -737,7 +737,11 @@ impl Discovery { }; // predicate for finding nodes with a matching fork and valid tcp port let eth2_fork_predicate = move |enr: &Enr| { - enr.eth2() == Ok(enr_fork_id.clone()) && (enr.tcp().is_some() || enr.tcp6().is_some()) + // `next_fork_epoch` and `next_fork_version` can be different so that + // we can connect to peers who aren't compatible with an upcoming fork. + // `fork_digest` **must** be same. + enr.eth2().map(|e| e.fork_digest) == Ok(enr_fork_id.fork_digest) + && (enr.tcp().is_some() || enr.tcp6().is_some()) }; // General predicate