func (handler *ConsensusHandler) HandleMessage(msg *pb.Message) error {
	if msg.Type == pb.Message_CONSENSUS {
		senderPE, _ := handler.peerHandler.To()
		select {
		case handler.consenterChan <- &util.Message{
			Msg:    msg,
			Sender: senderPE.ID,
		}:
			return nil
		default:
			err := fmt.Errorf("Message channel for %v full, rejecting", senderPE.ID)
			logger.Error("Failed to queue consensus message because: %v", err)
			return err
		}
	} else if msg.Type == pb.Message_CHAIN_TRANSACTION {
		tx := &pb.Transaction{}
		err := proto.Unmarshal(msg.Payload, tx)
		if err == nil {
			if tx.Type == pb.Transaction_CHAINCODE_QUERY {
				return handler.doChainQuery(tx)
			}
		  return handler.doChainTransaction(msg, tx)
		}
	}

	if logger.IsEnabledFor(logging.DEBUG) {
		logger.Debug("Did not handle message of type %s, passing on to next MessageHandler", msg.Type)
	}
	return handler.peerHandler.HandleMessage(msg)
}
// HandleMessage handles the incoming Fabric messages for the Peer
HandleMessage handles the incoming Fabric messages for the Peer
// HandleMessage handles the incoming Fabric messages for the Peer
func (handler *ConsensusHandler) HandleMessage(msg *pb.Message) error {
	if msg.Type == pb.Message_CONSENSUS {
		senderPE, _ := handler.peerHandler.To()
		select {
		case handler.consenterChan <- &util.Message{
			Msg:    msg,
			Sender: senderPE.ID,
		}:
			return nil
		default:
			err := fmt.Errorf("Message channel for %v full, rejecting", senderPE.ID)
			logger.Error("Failed to queue consensus message because: %v", err)
			return err
		}
	} else if msg.Type == pb.Message_CHAIN_TRANSACTION {
		tx := &pb.Transaction{}
		err := proto.Unmarshal(msg.Payload, tx)
		if err == nil {
			if tx.Type == pb.Transaction_CHAINCODE_QUERY {
				return handler.doChainQuery(tx)
			}
		  return handler.doChainTransaction(msg, tx)
		}
	}
	if logger.IsEnabledFor(logging.DEBUG) {
		logger.Debug("Did not handle message of type %s, passing on to next MessageHandler", msg.Type)
	}
	return handler.peerHandler.HandleMessage(msg)
}
func ( handler * ConsensusHandler ) HandleMessage ( msg * pb . Message ) error { if msg . Type == pb . Message_CONSENSUS { senderPE , _ := handler . peerHandler . To ( ) select { case handler . consenterChan <- & util . Message { Msg : msg , Sender : senderPE . ID , } : return nil default : err := fmt . Errorf ( " " , senderPE . ID ) logger . Error ( " " , err ) return err } } else if msg . Type == pb . Message_CHAIN_TRANSACTION { tx := & pb . Transaction { } err := proto . Unmarshal ( msg . Payload , tx ) if err == nil { if tx . Type == pb . Transaction_CHAINCODE_QUERY { return handler . doChainQuery ( tx ) } return handler . doChainTransaction ( msg , tx ) } } if logger . IsEnabledFor ( logging . DEBUG ) { logger . Debug ( " " , msg . Type ) } return handler . peerHandler . HandleMessage ( msg ) }
HandleMessage handles the incoming Fabric messages for the Peer
HandleMessage handles the incoming Fabric messages for the Peer