Check the node map to avoid dupes in resolved nodes
This commit is contained in:
parent
18ea19a122
commit
2e47fdc6f5
@ -171,12 +171,18 @@ func (n *network) resolveNodes() ([]string, error) {
|
|||||||
|
|
||||||
// collect network node addresses
|
// collect network node addresses
|
||||||
var nodes []string
|
var nodes []string
|
||||||
|
var i int
|
||||||
|
|
||||||
i := 0
|
|
||||||
for _, record := range records {
|
for _, record := range records {
|
||||||
nodes = append(nodes, record.Address)
|
if _, ok := nodeMap[record.Address]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
nodeMap[record.Address] = true
|
nodeMap[record.Address] = true
|
||||||
|
nodes = append(nodes, record.Address)
|
||||||
|
|
||||||
i++
|
i++
|
||||||
|
|
||||||
// break once MaxConnection nodes has been reached
|
// break once MaxConnection nodes has been reached
|
||||||
if i == MaxConnections {
|
if i == MaxConnections {
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user