From 325d12027452f2556126463f325c7dd2bd32898c Mon Sep 17 00:00:00 2001 From: kdeme Date: Wed, 3 Jul 2019 18:50:23 +0200 Subject: [PATCH] Add capability-id and context-id rlp list in header-data for Parity compatibility --- eth/p2p/rlpxcrypt.nim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eth/p2p/rlpxcrypt.nim b/eth/p2p/rlpxcrypt.nim index bcd15d1..875f0fd 100644 --- a/eth/p2p/rlpxcrypt.nim +++ b/eth/p2p/rlpxcrypt.nim @@ -141,6 +141,13 @@ proc encryptMsg*(msg: openarray[byte], secrets: var SecretState): seq[byte] = header[1] = byte((msg.len shr 8) and 0xFF) header[2] = byte(msg.len and 0xFF) + # This is the [capability-id, context-id] in header-data + # While not really used, this is checked in the Parity client. + # Same as rlp.encode((0, 0)) + header[3] = 0xc2 + header[4] = 0x80 + header[5] = 0x80 + # XXX: # This would be safer if we use a thread-local sequ for the temporary buffer result = newSeq[byte](encryptedLength(msg.len))