You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.
func (k *Kademlia) eachConn(base []byte, o int, f func(*Peer, int, bool) bool) {
if len(base) == 0 {
base = k.base
}
depth := depthForPot(k.conns, k.MinProxBinSize, k.base)
k.conns.EachNeighbour(base, pof, func(val pot.Val, po int) bool {
if po > o {
return true
}
return f(val.(*Peer), po, po >= depth)
})
}
where in f func(*Peer, int, bool) the second parameter is po and the third isProxBin.
The depth is a property in relation to k.base - the base address of the kademlia.
However, the po compared to this depth to determine whether or not the Peer is in the proxbin (nearest neighbour) of the base of the kademlia is effectively the po between the passedbase and the peer.
If the po of passedbase in relation to Peer is higher than depth, the Peer can be erroneously be returned as a nearest neighbor.
Additionally, this raises the question of which assumptions have been made for the behavior of this function by the code that uses it.
The text was updated successfully, but these errors were encountered:
where in
f func(*Peer, int, bool)
the second parameter ispo
and the thirdisProxBin
.The
depth
is a property in relation tok.base
- the base address of the kademlia.However, the
po
compared to thisdepth
to determine whether or not thePeer
is in theproxbin
(nearest neighbour) of the base of the kademlia is effectively thepo
between the passedbase
and the peer.If the
po
of passedbase
in relation toPeer
is higher thandepth
, the Peer can be erroneously be returned as a nearest neighbor.Additionally, this raises the question of which assumptions have been made for the behavior of this function by the code that uses it.
The text was updated successfully, but these errors were encountered: