From 942e9782697fbdfbf09063157636839c15947c28 Mon Sep 17 00:00:00 2001 From: kdeme Date: Fri, 6 Mar 2020 15:57:54 +0100 Subject: [PATCH] discv5: Fix invalid packet in pendingRequest --- eth/p2p/discoveryv5/protocol.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eth/p2p/discoveryv5/protocol.nim b/eth/p2p/discoveryv5/protocol.nim index cffc2ad..c30eeb1 100644 --- a/eth/p2p/discoveryv5/protocol.nim +++ b/eth/p2p/discoveryv5/protocol.nim @@ -338,8 +338,9 @@ proc revalidateNode(p: Protocol, n: Node) let reqId = newRequestId() var ping: PingPacket ping.enrSeq = p.localNode.record.seqNum - let (data, nonce) = p.codec.encodeEncrypted(n, encodePacket(ping, reqId), challenge = nil) - p.pendingRequests[nonce] = PendingRequest(node: n, packet: data) + let packet = encodePacket(ping, reqId) + let (data, nonce) = p.codec.encodeEncrypted(n, packet, challenge = nil) + p.pendingRequests[nonce] = PendingRequest(node: n, packet: packet) p.send(n, data) let resp = await p.waitPacket(n, reqId)