atoulme commented on a change in pull request #38: v5 UDP packet handling
URL: https://github.com/apache/incubator-tuweni/pull/38#discussion_r335447839
##########
File path:
devp2p/src/main/kotlin/org/apache/tuweni/devp2p/v5/packet/WhoAreYouMessage.kt
##########
@@ -0,0 +1,36 @@
+package org.apache.tuweni.devp2p.v5.packet
+
+import org.apache.tuweni.bytes.Bytes
+import org.apache.tuweni.crypto.SECP256K1
+import org.apache.tuweni.devp2p.v5.MessageDecoder
+import org.apache.tuweni.rlp.RLP
+import java.nio.ByteBuffer
+
+class WhoAreYouMessage(
+ src: Bytes,
+ dest: Bytes,
+ val authTag: Bytes = authTag(),
+ val idNonce: Bytes = idNonce()
+): UdpMessage(src, dest) {
+
+ override fun encode(): ByteBuffer {
+ val magic = magic(src)
+ val rlpBody = RLP.encodeList { w ->
+ w.writeByteArray(authTag.toArray())
+ w.writeByteArray(idNonce.toArray())
+ }
+ val messageBytes = Bytes.wrap(magic, rlpBody) // TODO: ENR seq number
+ return ByteBuffer.wrap(messageBytes.toArray())
Review comment:
yep, really should be returning Bytes here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]