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)
|
? n.record.update(pk, ip, tcpPort, udpPort, extraFields)
|
||||||
|
|
||||||
if ip.isSome():
|
if ip.isSome():
|
||||||
let a = Address(ip: ip.get(), port: Port(udpPort))
|
let a = Address(ip: ip.get(), port: udpPort)
|
||||||
n.address = some(a)
|
n.address = some(a)
|
||||||
else:
|
else:
|
||||||
n.address = none(Address)
|
n.address = none(Address)
|
||||||
|
|
|
@ -672,11 +672,16 @@ proc lookup*(d: Protocol, target: NodeId): Future[seq[Node]]
|
||||||
if pendingQueries.len == 0:
|
if pendingQueries.len == 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
let idx = await oneIndex(pendingQueries)
|
let query = await one(pendingQueries)
|
||||||
trace "Got discv5 lookup response", idx
|
trace "Got discv5 lookup query response"
|
||||||
|
|
||||||
let nodes = pendingQueries[idx].read
|
let index = pendingQueries.find(query)
|
||||||
pendingQueries.del(idx)
|
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:
|
for n in nodes:
|
||||||
if not seen.containsOrIncl(n.id):
|
if not seen.containsOrIncl(n.id):
|
||||||
if result.len < BUCKET_SIZE:
|
if result.len < BUCKET_SIZE:
|
||||||
|
|
Loading…
Reference in New Issue