code: func (r *HandlerRegistry) Register(h *Handler) error {
  	r.mutex.Lock()
  	defer r.mutex.Unlock()
  	key := h.chaincodeID.Name
  
  	if r.handlers[key] != nil {
  		chaincodeLogger.Debugf("duplicate registered handler(key:%s) return error", key)
  		return errors.Errorf("duplicate chaincodeID: %s", h.chaincodeID.Name)
  	}
  
  	// This chaincode was not launched by the peer but is attempting
  	// to register. Only allowed in development mode.
  	if r.launching[key] == nil && !r.allowUnsolicitedRegistration {
  		return errors.Errorf("peer will not accept external chaincode connection %v (except in dev mode)", h.chaincodeID.Name)
  	}
  
  	r.handlers[key] = h
  
  	chaincodeLogger.Debugf("registered handler complete for chaincode %s", key)
  	return nil
  }
docs: // Register adds a chaincode handler to the registry.
  // An error will be returned if a handler is already registered for the
  // chaincode. An error will also be returned if the chaincode has not already
  // been "launched", and unsolicited registration is not allowed.