Commit graph

1 commit

Author SHA1 Message Date
rayoo
5013c7931a cmd/devp2p/internal/ethtest: fix disconnect decoding in status exchange
The disconnect-message branch in statusExchange had two bugs that are
the twin of the one fixed in rlpxcmd.go by #34781:
the error return from rlp.DecodeBytes was ignored, so decode failures
silently produced an "invalid disconnect message" error with no
context; and the decoder assumed the spec-compliant list form
exclusively, while older geth and some other implementations send the
reason as a bare byte.

Add a decodeDisconnect helper that accepts both wire forms (matching
the legacy-tolerant behavior in p2p.decodeDisconnectMessage) and, on
decode failure, include the raw payload so operators can see exactly
what the peer sent. Add a unit test for the decoder covering both
forms plus the empty-payload error path.
2026-04-24 15:26:53 +08:00