Check the node map to avoid dupes in resolved nodes

This commit is contained in:
Asim Aslam 2019-10-12 20:26:06 +01:00
parent 18ea19a122
commit 2e47fdc6f5

View File

@ -171,12 +171,18 @@ func (n *network) resolveNodes() ([]string, error) {
// collect network node addresses
var nodes []string
var i int
i := 0
for _, record := range records {
nodes = append(nodes, record.Address)
if _, ok := nodeMap[record.Address]; ok {
continue
}
nodeMap[record.Address] = true
nodes = append(nodes, record.Address)
i++
// break once MaxConnection nodes has been reached
if i == MaxConnections {
break