diff --git a/core/bootstrap.go b/core/bootstrap.go index 2fa32da1842810cd0c675c4f8638457b9b6929a3..2c47529706a70345c49a8dc81214fd806d1851c6 100644 --- a/core/bootstrap.go +++ b/core/bootstrap.go @@ -225,8 +225,11 @@ func toPeerInfo(bp config.BootstrapPeer) peer.PeerInfo { func randomSubsetOfPeers(in []peer.PeerInfo, max int) []peer.PeerInfo { n := math2.IntMin(max, len(in)) var out []peer.PeerInfo - for _, val := range rand.Perm(n) { + for _, val := range rand.Perm(len(in)) { out = append(out, in[val]) + if len(out) >= n { + break + } } return out }