mirror of
https://github.com/status-im/nim-eth.git
synced 2025-02-20 17:58:20 +00:00
protocol.sendMessage: allow destination as (NodeId, Address)
This commit is contained in:
parent
9b86ade602
commit
7f1fd9f3d2
@ -379,6 +379,18 @@ proc waitNodes(d: Protocol, fromNode: Node, reqId: RequestId):
|
||||
discovery_message_requests_outgoing.inc(labelValues = ["no_response"])
|
||||
return err("Nodes message not received in time")
|
||||
|
||||
proc sendMessage*[T: SomeMessage](d: Protocol, toId: NodeId, toAddr: Address, m: T):
|
||||
RequestId =
|
||||
let
|
||||
reqId = RequestId.init(d.rng[])
|
||||
message = encodeMessage(m, reqId)
|
||||
|
||||
trace "Send message packet", dstId = toId, toAddr, kind = messageKind(T)
|
||||
discovery_message_requests_outgoing.inc()
|
||||
|
||||
d.transport.sendMessage(toId, toAddr, message)
|
||||
return reqId
|
||||
|
||||
proc sendMessage*[T: SomeMessage](d: Protocol, toNode: Node, m: T):
|
||||
RequestId =
|
||||
doAssert(toNode.address.isSome())
|
||||
|
Loading…
x
Reference in New Issue
Block a user