Update Kademlia randomBytes
This commit is contained in:
parent
d09010db11
commit
831d26e223
|
@ -387,12 +387,12 @@ proc lookup*(k: KademliaProtocol, nodeId: NodeId): Future[seq[Node]] {.async.} =
|
||||||
sortByDistance(closest, nodeId, BUCKET_SIZE)
|
sortByDistance(closest, nodeId, BUCKET_SIZE)
|
||||||
nodesToAsk = excludeIfAsked(closest)
|
nodesToAsk = excludeIfAsked(closest)
|
||||||
|
|
||||||
info "lookup finished for ", nodeId.toHex(), ": ", closest
|
info "lookup finished for ", nodeId.toHex, ": ", closest
|
||||||
result = closest
|
result = closest
|
||||||
|
|
||||||
proc lookupRandom*(k: KademliaProtocol): Future[seq[Node]] =
|
proc lookupRandom*(k: KademliaProtocol): Future[seq[Node]] =
|
||||||
var id: NodeId
|
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)
|
k.lookup(id)
|
||||||
|
|
||||||
proc resolve*(k: KademliaProtocol, id: NodeId): Future[Node] {.async.} =
|
proc resolve*(k: KademliaProtocol, id: NodeId): Future[Node] {.async.} =
|
||||||
|
|
Loading…
Reference in New Issue