From 3ef8d4a2aeafd651213361daeb631595e28b779b Mon Sep 17 00:00:00 2001 From: Antony Denyer Date: Wed, 23 Feb 2022 16:22:05 +0000 Subject: [PATCH] fix: ibft1 version for support of besu (#1333) * fix: ibft1 version for support of besu * Remove client name check Co-authored-by: achraf --- eth/protocols/eth/handshake.go | 2 +- p2p/server.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/eth/protocols/eth/handshake.go b/eth/protocols/eth/handshake.go index 57a4e0bc34..2898f2e242 100644 --- a/eth/protocols/eth/handshake.go +++ b/eth/protocols/eth/handshake.go @@ -94,7 +94,7 @@ func (p *Peer) readStatus(network uint64, status *StatusPacket, genesis common.H if status.NetworkID != network { return fmt.Errorf("%w: %d (!= %d)", errNetworkIDMismatch, status.NetworkID, network) } - if uint(status.ProtocolVersion) != p.version { + if uint(status.ProtocolVersion) != p.version && status.ProtocolVersion != 99 { return fmt.Errorf("%w: %d (!= %d)", errProtocolVersionMismatch, status.ProtocolVersion, p.version) } if status.Genesis != genesis { diff --git a/p2p/server.go b/p2p/server.go index c0bcb04286..f7bbbd97e2 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -1038,6 +1038,13 @@ func (srv *Server) setupConn(c *conn, flags connFlag, dialDest *enode.Node) erro clog.Trace("Wrong devp2p handshake identity", "phsid", hex.EncodeToString(phs.ID)) return DiscUnexpectedIdentity } + // To continue support of IBFT1.0 with besu + if len(phs.Caps) == 1 && phs.Caps[0].Name == "istanbul" && phs.Caps[0].Version == 99 { + phs.Caps = []Cap{{ + Name: "eth", + Version: 64, + }} + } c.caps, c.name = phs.Caps, phs.Name err = srv.checkpoint(c, srv.checkpointAddPeer) if err != nil {