func connectNodesInRing(net *Network, nodeCount int) ([]discover.NodeID, error) {
	ids := make([]discover.NodeID, nodeCount)
	for i := 0; i < nodeCount; i++ {
		node, err := net.NewNode()
		if err != nil {
			log.Error("Error creating a node! %s", err)
			return nil, err
		}
		ids[i] = node.ID()
	}

	for _, id := range ids {
		if err := net.Start(id); err != nil {
			log.Error("Error starting a node! %s", err)
			return nil, err
		}
		log.Debug(fmt.Sprintf("node %v starting up", id))
	}
	for i, id := range ids {
		peerID := ids[(i+1)%len(ids)]
		if err := net.Connect(id, peerID); err != nil {
			log.Error("Error connecting a node to a peer! %s", err)
			return nil, err
		}
	}

	return ids, nil
}
//connect nodeCount number of nodes in a ring
connect nodeCount number of nodes in a ring
// connect nodeCount number of nodes in a ring
func connectNodesInRing(net *Network, nodeCount int) ([]discover.NodeID, error) {
	ids := make([]discover.NodeID, nodeCount)
	for i := 0; i < nodeCount; i++ {
		node, err := net.NewNode()
		if err != nil {
			log.Error("Error creating a node! %s", err)
			return nil, err
		}
		ids[i] = node.ID()
	}
	for _, id := range ids {
		if err := net.Start(id); err != nil {
			log.Error("Error starting a node! %s", err)
			return nil, err
		}
		log.Debug(fmt.Sprintf("node %v starting up", id))
	}
	for i, id := range ids {
		peerID := ids[(i+1)%len(ids)]
		if err := net.Connect(id, peerID); err != nil {
			log.Error("Error connecting a node to a peer! %s", err)
			return nil, err
		}
	}
	return ids, nil
}
func connectNodesInRing ( net * Network , nodeCount int ) ( [ ] discover . NodeID , error ) { ids := make ( [ ] discover . NodeID , nodeCount ) for i := 0 ; i < nodeCount ; i ++ { node , err := net . NewNode ( ) if err != nil { log . Error ( " " , err ) return nil , err } ids [ i ] = node . ID ( ) } for _ , id := range ids { if err := net . Start ( id ) ; err != nil { log . Error ( " " , err ) return nil , err } log . Debug ( fmt . Sprintf ( " " , id ) ) } for i , id := range ids { peerID := ids [ ( i + 1 ) % len ( ids ) ] if err := net . Connect ( id , peerID ) ; err != nil { log . Error ( " " , err ) return nil , err } } return ids , nil }
connect nodeCount number of nodes in a ring
connect nodeCount number of nodes in a ring