code: func (cs *ChainSupport) detectMigration(lastBlock *cb.Block) bool {
  	isMigration := false
  
  	if !cs.ledgerResources.SharedConfig().Capabilities().Kafka2RaftMigration() {
  		return isMigration
  	}
  
  	lastConfigIndex, err := utils.GetLastConfigIndexFromBlock(lastBlock)
  	if err != nil {
  		logger.Panicf("Chain did not have appropriately encoded last config in its latest block: %s", err)
  	}
  
  	logger.Debugf("[channel: %s], sysChan=%v, lastConfigIndex=%d, H=%d, mig-state: %s",
  		cs.ChainID(), cs.systemChannel, lastConfigIndex, cs.ledgerResources.Height(),
  		cs.ledgerResources.SharedConfig().ConsensusMigrationState())
  
  	if lastConfigIndex == lastBlock.Header.Number { //The last block was a config-tx
  		state := cs.ledgerResources.SharedConfig().ConsensusMigrationState()
  		if cs.systemChannel {
  			if state == orderer.ConsensusType_MIG_STATE_COMMIT {
  				isMigration = true
  			}
  		} else {
  			if state == orderer.ConsensusType_MIG_STATE_CONTEXT {
  				isMigration = true
  			}
  		}
  
  		if isMigration {
  			logger.Infof("[channel: %s], Restarting after consensus-type migration. New consensus-type is: %s",
  				cs.ChainID(), cs.ledgerResources.SharedConfig().ConsensusType())
  		}
  	}
  
  	return isMigration
  }
docs: // detectMigration identifies restart after consensus-type migration was committed (green path).
  // Restart after migration is detected by:
  // 1. The Kafka2RaftMigration capability in on
  // 2. The last block carries a config-tx
  // 3. In the config-tx, you have:
  //    - (system-channel && state=COMMIT), OR
  //    - (standard-channel && state=CONTEXT)
  // This assumes that migration was successful (green path). When migration ends successfully,
  // every channel will have a config block as the last block. On the system channel, containing state=COMMIT;
  // on standard channels, containing state=CONTEXT.