quick fix local lookup

This commit is contained in:
Csaba Kiraly 2022-02-16 10:10:36 +01:00
parent 31d99ad56e
commit 57a339d326
1 changed files with 3 additions and 0 deletions

View File

@ -113,6 +113,9 @@ proc sendAddProvider*(p: ProvidersProtocol, dst: Node, cId: NodeId, pr: PeerReco
proc addProvider*(p: ProvidersProtocol, cId: NodeId, pr: PeerRecord): Future[seq[Node]] {.async.} =
result = await p.discovery.lookup(cId)
# TODO: lookup is sepcified as not returning local, even if that is the closest. Is this OK?
if result.len == 0:
result.add(p.discovery.localNode)
for n in result:
if n != p.discovery.localNode:
p.sendAddProvider(n, cId, pr)