code: func (c *Chain) detectMigration() bool {
  	startOfChain := false
  	if c.support.SharedConfig().Capabilities().Kafka2RaftMigration() {
  		lastConfigIndex, err := utils.GetLastConfigIndexFromBlock(c.lastBlock)
  		if err != nil {
  			c.logger.Panicf("Chain did not have appropriately encoded last config in its latest block: %s", err)
  		}
  
  		c.logger.Debugf("Detecting if consensus-type migration, sysChan=%v, lastConfigIndex=%d, Height=%d, mig-state: %s",
  			c.support.IsSystemChannel(), lastConfigIndex, c.lastBlock.Header.Number+1, c.support.SharedConfig().ConsensusMigrationState().String())
  
  		if lastConfigIndex != c.lastBlock.Header.Number { // The last block is not a config-tx
  			return startOfChain
  		}
  
  		// The last block was a config-tx
  		if c.support.IsSystemChannel() {
  			if c.support.SharedConfig().ConsensusMigrationState() == orderer.ConsensusType_MIG_STATE_COMMIT {
  				startOfChain = true
  			}
  		} else {
  			if c.support.SharedConfig().ConsensusMigrationState() == orderer.ConsensusType_MIG_STATE_CONTEXT {
  				startOfChain = true
  			}
  		}
  
  		if startOfChain {
  			c.logger.Infof("Restarting after consensus-type migration. Type: %s, just starting the channel.", c.support.SharedConfig().ConsensusType())
  		}
  	}
  	return startOfChain
  }
docs: // detectMigration detects if the orderer restarts right after consensus-type migration,
  // in which the Height>1 but previous blocks were created by Kafka.
  // If this is the case, Raft should be started like it is joining a new channel.