Skip to content

Commit 4dfaf23

Browse files
authored
chore(net): fix misleading comment about uncompressed message size check (#19510)
1 parent 4cf36dd commit 4dfaf23

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/net/eth-wire/src/p2pstream.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ where
101101
.or(Err(P2PStreamError::HandshakeError(P2PHandshakeError::Timeout)))?
102102
.ok_or(P2PStreamError::HandshakeError(P2PHandshakeError::NoResponse))??;
103103

104-
// let's check the compressed length first, we will need to check again once confirming
105-
// that it contains snappy-compressed data (this will be the case for all non-p2p messages).
104+
// Check that the uncompressed message length does not exceed the max payload size.
105+
// Note: The first message (Hello/Disconnect) is not snappy compressed. We will check the
106+
// decompressed length again for subsequent messages after the handshake.
106107
if first_message_bytes.len() > MAX_PAYLOAD_SIZE {
107108
return Err(P2PStreamError::MessageTooBig {
108109
message_size: first_message_bytes.len(),

0 commit comments

Comments
 (0)