code: func (h *Handler) handleMessage(msg *pb.ChaincodeMessage) error {
  	chaincodeLogger.Debugf("[%s] Fabric side handling ChaincodeMessage of type: %s in state %s", shorttxid(msg.Txid), msg.Type, h.state)
  
  	if msg.Type == pb.ChaincodeMessage_KEEPALIVE {
  		return nil
  	}
  
  	switch h.state {
  	case Created:
  		return h.handleMessageCreatedState(msg)
  	case Ready:
  		return h.handleMessageReadyState(msg)
  	default:
  		return errors.Errorf("handle message: invalid state %s for transaction %s", h.state, msg.Txid)
  	}
  }
docs: // handleMessage is called by ProcessStream to dispatch messages.