From 412b02f416ca59dcaf44f39101a80c2c9b64012a Mon Sep 17 00:00:00 2001 From: lash Date: Fri, 21 Dec 2018 08:56:51 +0100 Subject: [PATCH] swarm/network: Add comments --- swarm/network/kademlia.go | 2 +- swarm/network/kademlia_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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