code: func (nDB *NetworkDB) changeNodeState(nodeName string, newState nodeState) (bool, error) {
  	n, currState, m := nDB.findNode(nodeName)
  	if n == nil {
  		return false, fmt.Errorf("node %s not found", nodeName)
  	}
  
  	switch newState {
  	case nodeActiveState:
  		if currState == nodeActiveState {
  			return false, nil
  		}
  
  		delete(m, nodeName)
  		// reset the node reap time
  		n.reapTime = 0
  		nDB.nodes[nodeName] = n
  	case nodeLeftState:
  		if currState == nodeLeftState {
  			return false, nil
  		}
  
  		delete(m, nodeName)
  		nDB.leftNodes[nodeName] = n
  	case nodeFailedState:
  		if currState == nodeFailedState {
  			return false, nil
  		}
  
  		delete(m, nodeName)
  		nDB.failedNodes[nodeName] = n
  	}
  
  	logrus.Infof("Node %s change state %s --> %s", nodeName, nodeStateName[currState], nodeStateName[newState])
  
  	if newState == nodeLeftState || newState == nodeFailedState {
  		// set the node reap time, if not already set
  		// It is possible that a node passes from failed to left and the reaptime was already set so keep that value
  		if n.reapTime == 0 {
  			n.reapTime = nodeReapInterval
  		}
  		// The node leave or fails, delete all the entries created by it.
  		// If the node was temporary down, deleting the entries will guarantee that the CREATE events will be accepted
  		// If the node instead left because was going down, then it makes sense to just delete all its state
  		nDB.deleteNodeFromNetworks(n.Name)
  		nDB.deleteNodeTableEntries(n.Name)
  	}
  
  	return true, nil
  }
docs: // changeNodeState changes the state of the node specified, returns true if the node was moved,
  // false if there was no need to change the node state. Error will be returned if the node does not
  // exists