Update Kademlia randomBytes

This commit is contained in:
mratsim 2018-05-08 14:46:49 +02:00
parent d09010db11
commit 831d26e223
1 changed files with 2 additions and 2 deletions

View File

@ -387,12 +387,12 @@ proc lookup*(k: KademliaProtocol, nodeId: NodeId): Future[seq[Node]] {.async.} =
sortByDistance(closest, nodeId, BUCKET_SIZE)
nodesToAsk = excludeIfAsked(closest)
info "lookup finished for ", nodeId.toHex(), ": ", closest
info "lookup finished for ", nodeId.toHex, ": ", closest
result = closest
proc lookupRandom*(k: KademliaProtocol): Future[seq[Node]] =
var id: NodeId
discard randomBytes(addr id.table[0], sizeof(id.table)) ## TODO What is supposed to happen here?
discard randomBytes(addr id, id.sizeof)
k.lookup(id)
proc resolve*(k: KademliaProtocol, id: NodeId): Future[Node] {.async.} =