code: func (g *gossipServiceImpl) gossipInChan(messages []*emittedGossipMessage, chanRoutingFactory channelRoutingFilterFactory) {
  	if len(messages) == 0 {
  		return
  	}
  	totalChannels := extractChannels(messages)
  	var channel common.ChainID
  	var messagesOfChannel []*emittedGossipMessage
  	for len(totalChannels) > 0 {
  		// Take first channel
  		channel, totalChannels = totalChannels[0], totalChannels[1:]
  		// Extract all messages of that channel
  		grabMsgs := func(o interface{}) bool {
  			return bytes.Equal(o.(*emittedGossipMessage).Channel, channel)
  		}
  		messagesOfChannel, messages = partitionMessages(grabMsgs, messages)
  		if len(messagesOfChannel) == 0 {
  			continue
  		}
  		// Grab channel object for that channel
  		gc := g.chanState.getGossipChannelByChainID(channel)
  		if gc == nil {
  			g.logger.Warning("Channel", channel, "wasn't found")
  			continue
  		}
  		// Select the peers to send the messages to
  		// For leadership messages we will select all peers that pass routing factory - e.g. all peers in channel and org
  		membership := g.disc.GetMembership()
  		var peers2Send []*comm.RemotePeer
  		if messagesOfChannel[0].IsLeadershipMsg() {
  			peers2Send = filter.SelectPeers(len(membership), membership, chanRoutingFactory(gc))
  		} else {
  			peers2Send = filter.SelectPeers(g.conf.PropagatePeerNum, membership, chanRoutingFactory(gc))
  		}
  
  		// Send the messages to the remote peers
  		for _, msg := range messagesOfChannel {
  			filteredPeers := g.removeSelfLoop(msg, peers2Send)
  			g.comm.Send(msg.SignedGossipMessage, filteredPeers...)
  		}
  	}
  }
docs: // gossipInChan gossips a given GossipMessage slice according to a channel's routing policy.