Skip to content

Commit 80eca89

Browse files
committed
swarm/network: minor comment, discovery test default arg
1 parent 94cd49d commit 80eca89

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

swarm/network/kademlia.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,9 @@ func (k *Kademlia) SuggestPeer() (suggestedPeer *BzzAddr, saturationDepth int, c
173173
k.lock.Lock()
174174
defer k.lock.Unlock()
175175
radius := neighbourhoodRadiusForPot(k.conns, k.NeighbourhoodSize, k.base)
176-
// first collect undersaturated bins starting from smallest size from shallow to deep
177-
// saturation is a map: bin size (int) -> deepening list of PO bins with that size ([]int)
176+
// collect undersaturated bins in ascending order of number of connected peers
177+
// and from shallow to deep (ascending order of PO)
178+
// insert them in a map of bin arrays, keyed with the number of connected peers
178179
saturation := make(map[int][]int)
179180
var lastPO int // the last non-empty PO bin in the iteration
180181
saturationDepth = -1 // the deepest PO such that all shallower bins have >= k.MinBinSize peers

swarm/network/simulations/discovery/discovery_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func getDbStore(nodeID string) (*state.DBStore, error) {
8282
}
8383

8484
var (
85-
nodeCount = flag.Int("nodes", 10, "number of nodes to create (default 10)")
85+
nodeCount = flag.Int("nodes", 32, "number of nodes to create (default 32)")
8686
initCount = flag.Int("conns", 1, "number of originally connected peers (default 1)")
8787
loglevel = flag.Int("loglevel", 3, "verbosity of logs")
8888
rawlog = flag.Bool("rawlog", false, "remove terminal formatting from logs")

0 commit comments

Comments
 (0)