diff --git a/swarm/network/kademlia.go b/swarm/network/kademlia.go index 2dec6d7836..c5c2d79e3b 100644 --- a/swarm/network/kademlia.go +++ b/swarm/network/kademlia.go @@ -474,7 +474,7 @@ func depthForPot(p *pot.Pot, minProxBinSize int, pivotAddr []byte) (depth int) { } p.EachNeighbour(pivotAddr, Pof, f) - // the second step is to start from the top and test for empty bins + // the second step is to test for empty bins in order from shallowest to deepest // if an empty bin is found, this will be the actual depth // we stop iterating if we hit the maxDepth determined in the first step p.EachBin(pivotAddr, Pof, 0, func(po int, _ int, f func(func(pot.Val, int) bool) bool) bool { diff --git a/swarm/network/kademlia_test.go b/swarm/network/kademlia_test.go index de03dbef23..773f201ac0 100644 --- a/swarm/network/kademlia_test.go +++ b/swarm/network/kademlia_test.go @@ -162,6 +162,8 @@ func TestNeighbourhoodDepth(t *testing.T) { testNum++ } +// TestHealthStrict tests the simplest definition of health +// Which means whether we are connected to all neighbors we know of func TestHealthStrict(t *testing.T) { // base address is all zeros