Add capability-id and context-id rlp list in header-data for Parity compatibility

This commit is contained in:
kdeme 2019-07-03 18:50:23 +02:00
parent 934a247c23
commit 325d120274
1 changed files with 7 additions and 0 deletions

View File

@ -141,6 +141,13 @@ proc encryptMsg*(msg: openarray[byte], secrets: var SecretState): seq[byte] =
header[1] = byte((msg.len shr 8) and 0xFF) header[1] = byte((msg.len shr 8) and 0xFF)
header[2] = byte(msg.len 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: # XXX:
# This would be safer if we use a thread-local sequ for the temporary buffer # This would be safer if we use a thread-local sequ for the temporary buffer
result = newSeq[byte](encryptedLength(msg.len)) result = newSeq[byte](encryptedLength(msg.len))