e2e: avoid seed nodes when statesyncing (#7006)

This commit is contained in:
Sam Kleinman
2021-09-27 14:08:08 -04:00
committed by GitHub
parent b879f71e8e
commit b150ea6b3e

View File

@@ -275,7 +275,17 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
}
})
for i, name := range peerNames {
if len(seedNames) > 0 && (i == 0 || r.Float64() >= 0.5) {
// there are seeds, statesync is disabled, and it's
// either the first peer by the sort order, and
// (randomly half of the remaining peers use a seed
// node; otherwise, choose some remaining set of the
// peers.
if len(seedNames) > 0 &&
manifest.Nodes[name].StateSync == e2e.StateSyncDisabled &&
(i == 0 || r.Float64() >= 0.5) {
// choose one of the seeds
manifest.Nodes[name].Seeds = uniformSetChoice(seedNames).Choose(r)
} else if i > 0 {
peers := uniformSetChoice(peerNames[:i])