Fix client mode checking

This commit is contained in:
Arnaud 2026-05-04 10:50:46 +04:00
parent c24955c442
commit 07b9e0427e
No known key found for this signature in database
GPG Key ID: A6C7C781817146FA
2 changed files with 5 additions and 6 deletions

View File

@ -986,8 +986,7 @@ proc revalidateNode*(d: Protocol, n: Node) {.async.} =
# Request new SPR
let nodes = await d.findNode(n, @[0'u16])
if nodes.isOk() and nodes[].len > 0:
if d.addNode(nodes[][0]):
d.trackedFutures.add(d.removeIfClientMode(nodes[][0]))
discard d.addNode(nodes[][0])
# Get IP and port from pong message and add it to the ip votes
trace "pong rx", n, myip = res.ip, myport = res.port

View File

@ -235,10 +235,10 @@ proc receive*(t: Transport, a: Address, packet: openArray[byte]) =
if t.client.addNode(node):
trace "Added new node to routing table after handshake", node, tablesize=t.client.nodesDiscovered()
# We keep adding the node in the line above in order to not break anything.
# Then we remove the node if it using client mode.
# The operation is async because the check is done over TalkProtocol.
t.client.trackedFutures.add(t.client.removeIfClientMode(node))
# We keep adding the node in the line above in order to not break anything.
# Then we remove the node if it using client mode.
# The operation is async because the check is done over TalkProtocol.
t.client.trackedFutures.add(t.client.removeIfClientMode(node))
discard t.sendPending(node)
else: