Skip to content

Commit

Permalink
fix: ibft1 version for support of besu (#1333)
Browse files Browse the repository at this point in the history
* fix: ibft1 version for support of besu
* Remove client name check

Co-authored-by: achraf <[email protected]>
  • Loading branch information
antonydenyer and achraf17 authored Feb 23, 2022
1 parent a2d3e2c commit 3ef8d4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion eth/protocols/eth/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3ef8d4a

Please sign in to comment.