diff --git a/eth/p2p/discoveryv5/protocol.nim b/eth/p2p/discoveryv5/protocol.nim index 583d6a0..0afc7f0 100644 --- a/eth/p2p/discoveryv5/protocol.nim +++ b/eth/p2p/discoveryv5/protocol.nim @@ -383,14 +383,13 @@ proc sendMessage*[T: SomeMessage](d: Protocol, toNode: Node, m: T): RequestId = doAssert(toNode.address.isSome()) let - address = toNode.address.get() reqId = RequestId.init(d.rng[]) message = encodeMessage(m, reqId) trace "Send message packet", dstId = toNode.id, address, kind = messageKind(T) discovery_message_requests_outgoing.inc() - d.transport.sendMessage(toNode, address, message) + d.transport.sendMessage(toNode, message) return reqId proc ping*(d: Protocol, toNode: Node): diff --git a/eth/p2p/discoveryv5/transport.nim b/eth/p2p/discoveryv5/transport.nim index 7965fa2..c24d412 100644 --- a/eth/p2p/discoveryv5/transport.nim +++ b/eth/p2p/discoveryv5/transport.nim @@ -68,9 +68,11 @@ proc registerRequest(t: Transport, n: Node, message: seq[byte], t.pendingRequests.del(nonce) ##Todo: remove dependence on message. This should be higher -proc sendMessage*(t: Transport, toNode: Node, address: Address, message: seq[byte]) = - let (data, nonce) = encodeMessagePacket(t.rng[], t.codec, toNode.id, - address, message) +proc sendMessage*(t: Transport, toNode: Node, message: seq[byte]) = + doAssert(toNode.address.isSome()) + let address = toNode.address.get() + let (data, nonce) = encodeMessagePacket(t.rng[], t.codec, + toNode.id, address, message) t.registerRequest(toNode, message, nonce) t.send(toNode, data)