From 523df56ea2ae8f8ff5e2793d857585b1c5edccae Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Mon, 12 Aug 2024 08:13:40 -0700 Subject: [PATCH] feat: add forkid filtering (#339) * add forkid filtering * update error --- p2p/protocol.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/p2p/protocol.go b/p2p/protocol.go index 14da3350..8fcef238 100644 --- a/p2p/protocol.go +++ b/p2p/protocol.go @@ -215,7 +215,11 @@ func (c *conn) readStatus(packet *eth.StatusPacket) error { } if status.Genesis != packet.Genesis { - return fmt.Errorf("genesis mismatch: %d (!= %d)", status.Genesis, packet.Genesis) + return fmt.Errorf("genesis mismatch: %v (!= %v)", status.Genesis, packet.Genesis) + } + + if status.ForkID.Hash != packet.ForkID.Hash { + return fmt.Errorf("fork ID mismatch: %v (!= %v)", status.ForkID, packet.ForkID) } c.logger.Info().