From a0410e46b7194ddda92cb1134fddfaf7806b5262 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 17 Feb 2023 17:46:05 +0100 Subject: [PATCH] fix(disc): only start pinging new node if insert succesful (#1435) --- crates/net/discv4/src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/net/discv4/src/lib.rs b/crates/net/discv4/src/lib.rs index d91f4de812..4e9fdea5f7 100644 --- a/crates/net/discv4/src/lib.rs +++ b/crates/net/discv4/src/lib.rs @@ -809,13 +809,18 @@ impl Discv4Service { match self.kbuckets.entry(&key) { kbucket::Entry::Absent(entry) => { let node = NodeEntry::new(record); - let _ = entry.insert( + match entry.insert( node, NodeStatus { direction: ConnectionDirection::Outgoing, state: ConnectionState::Disconnected, }, - ); + ) { + BucketInsertResult::Inserted | BucketInsertResult::Pending { .. } => { + debug!(target : "discv4", ?record, "inserted new record"); + } + _ => return, + } } _ => return, }