code: func (nDB *NetworkDB) LeaveNetwork(nid string) error {
  	ltime := nDB.networkClock.Increment()
  	if err := nDB.sendNetworkEvent(nid, NetworkEventTypeLeave, ltime); err != nil {
  		return fmt.Errorf("failed to send leave network event for %s: %v", nid, err)
  	}
  
  	nDB.Lock()
  	defer nDB.Unlock()
  
  	// Remove myself from the list of the nodes participating to the network
  	nDB.deleteNetworkNode(nid, nDB.config.NodeID)
  
  	// Update all the local entries marking them for deletion and delete all the remote entries
  	nDB.deleteNodeNetworkEntries(nid, nDB.config.NodeID)
  
  	nodeNetworks, ok := nDB.networks[nDB.config.NodeID]
  	if !ok {
  		return fmt.Errorf("could not find self node for network %s while trying to leave", nid)
  	}
  
  	n, ok := nodeNetworks[nid]
  	if !ok {
  		return fmt.Errorf("could not find network %s while trying to leave", nid)
  	}
  
  	logrus.Debugf("%v(%v): leaving network %s", nDB.config.Hostname, nDB.config.NodeID, nid)
  	n.ltime = ltime
  	n.reapTime = nDB.config.reapNetworkInterval
  	n.leaving = true
  	return nil
  }
docs: // LeaveNetwork leaves this node from a given network and propagates
  // this event across the cluster. This triggers this node leaving the
  // sub-cluster of this network and as a result will no longer
  // participate in the network-scoped gossip and bulk sync for this
  // network. Also remove all the table entries for this network from
  // networkdb