From 59452116e8f0af049dd9fc46a8cc3693de1c9715 Mon Sep 17 00:00:00 2001 From: Kolby Moroz Liebl <31669092+KolbyML@users.noreply.github.com> Date: Tue, 11 Feb 2025 21:37:31 -0700 Subject: [PATCH] Use NodeContact instead of Enr for sending talk_req() --- src/discv5.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/discv5.rs b/src/discv5.rs index 626e9117..5b7d4553 100644 --- a/src/discv5.rs +++ b/src/discv5.rs @@ -267,6 +267,10 @@ impl Discv5

{ nodes_to_send } + pub fn ip_mode(&self) -> IpMode { + self.ip_mode + } + /// Mark a node in the routing table as `Disconnected`. /// /// A `Disconnected` node will be present in the routing table and will be only @@ -568,10 +572,10 @@ impl Discv5

{ } } - /// Request a TALK message from a node, identified via the ENR. + /// Request a TALK message from a node, identified via the NodeContact. pub fn talk_req( &self, - enr: Enr, + node_contact: NodeContact, protocol: Vec, request: Vec, ) -> impl Future, RequestError>> + 'static { @@ -579,10 +583,8 @@ impl Discv5

{ let (callback_send, callback_recv) = oneshot::channel(); let channel = self.clone_channel(); - let ip_mode = self.ip_mode; async move { - let node_contact = NodeContact::try_from_enr(enr, ip_mode)?; let channel = channel.map_err(|_| RequestError::ServiceNotStarted)?; let event = ServiceRequest::Talk(node_contact, protocol, request, callback_send);