Skip to content

Commit

Permalink
Merge pull request #14 from ethpandaops/fix/disconnect
Browse files Browse the repository at this point in the history
fix(execution/mimicry): empty disconnect reason
  • Loading branch information
Savid authored Jun 19, 2023
2 parents 69903db + 1e33641 commit 81a2acd
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pkg/execution/mimicry/message_disconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ func (h *Disconnect) Code() int { return DisconnectCode }
func (h *Disconnect) ReqID() uint64 { return 0 }

func (c *Client) receiveDisconnect(ctx context.Context, data []byte) *Disconnect {
reason := data[0:1]
// besu sends 2 byte disconnect message
if len(data) > 1 {
reason = data[1:2]
}

d := new(p2p.DiscReason)
if err := rlp.DecodeBytes(reason, &d); err != nil {
c.log.WithError(err).Debug("Error decoding disconnect")

if len(data) > 0 {
reason := data[0:1]
// besu sends 2 byte disconnect message
if len(data) > 1 {
reason = data[1:2]
}

if err := rlp.DecodeBytes(reason, &d); err != nil {
c.log.WithError(err).Debug("Error decoding disconnect")
}
}

return &Disconnect{Reason: *d}
Expand Down

0 comments on commit 81a2acd

Please sign in to comment.