add peers if no failover present

This commit is contained in:
0xdcarns
2022-09-28 15:49:02 -04:00
parent 40f7036093
commit 4f7583e2ec
3 changed files with 21 additions and 3 deletions

View File

@@ -250,6 +250,20 @@ func ValidateNode(node *models.Node, isUpdate bool) error {
return err
}
// IsFailoverPresent - checks if a node is marked as a failover in given network
func IsFailoverPresent(network string) bool {
netNodes, err := GetNetworkNodes(network)
if err != nil {
return false
}
for i := range netNodes {
if netNodes[i].Failover == "yes" {
return true
}
}
return false
}
// CreateNode - creates a node in database
func CreateNode(node *models.Node) error {