mirror of https://github.com/status-im/nim-eth.git
Use one instead of deprecated oneIndex (#317)
This commit is contained in:
parent
d024ea8e85
commit
0820dbba46
|
@ -52,7 +52,7 @@ proc updateNode*(n: Node, pk: PrivateKey, ip: Option[ValidIpAddress],
|
|||
? n.record.update(pk, ip, tcpPort, udpPort, extraFields)
|
||||
|
||||
if ip.isSome():
|
||||
let a = Address(ip: ip.get(), port: Port(udpPort))
|
||||
let a = Address(ip: ip.get(), port: udpPort)
|
||||
n.address = some(a)
|
||||
else:
|
||||
n.address = none(Address)
|
||||
|
|
|
@ -672,11 +672,16 @@ proc lookup*(d: Protocol, target: NodeId): Future[seq[Node]]
|
|||
if pendingQueries.len == 0:
|
||||
break
|
||||
|
||||
let idx = await oneIndex(pendingQueries)
|
||||
trace "Got discv5 lookup response", idx
|
||||
let query = await one(pendingQueries)
|
||||
trace "Got discv5 lookup query response"
|
||||
|
||||
let nodes = pendingQueries[idx].read
|
||||
pendingQueries.del(idx)
|
||||
let index = pendingQueries.find(query)
|
||||
if index != -1:
|
||||
pendingQueries.del(index)
|
||||
else:
|
||||
error "Resulting query should have beeen in the pending queries"
|
||||
|
||||
let nodes = query.read
|
||||
for n in nodes:
|
||||
if not seen.containsOrIncl(n.id):
|
||||
if result.len < BUCKET_SIZE:
|
||||
|
|
Loading…
Reference in New Issue