private PivotBlockSelector createPivotSelector(
      final ProtocolSchedule protocolSchedule,
      final ProtocolContext protocolContext,
      final EthContext ethContext,
      final SyncState syncState,
      final MetricsSystem metricsSystem,
      final Blockchain blockchain) {

    if (genesisConfigOptions.isQbft() || genesisConfigOptions.isIbft2()) {
      LOG.info(
          "{} is configured, creating initial sync for BFT",
          genesisConfigOptions.getConsensusEngine().toUpperCase(Locale.ROOT));
      return new BFTPivotSelectorFromPeers(
          ethContext,
          syncConfig,
          syncState,
          protocolContext,
          nodeKey,
          blockchain.getChainHeadHeader());
    } else if (genesisConfigOptions.getTerminalTotalDifficulty().isPresent()) {
      LOG.info("TTD difficulty is present, creating initial sync for PoS");

      final MergeContext mergeContext = protocolContext.getConsensusContext(MergeContext.class);
      final UnverifiedForkchoiceSupplier unverifiedForkchoiceSupplier =
          new UnverifiedForkchoiceSupplier();
      final long subscriptionId =
          mergeContext.addNewUnverifiedForkchoiceListener(unverifiedForkchoiceSupplier);

      final Runnable unsubscribeForkchoiceListener =
          () -> {
            mergeContext.removeNewUnverifiedForkchoiceListener(subscriptionId);
            LOG.info("Initial sync done, unsubscribe forkchoice supplier");
          };

      return new PivotSelectorFromSafeBlock(
          protocolContext,
          protocolSchedule,
          ethContext,
          metricsSystem,
          genesisConfigOptions,
          syncConfig,
          unverifiedForkchoiceSupplier,
          unsubscribeForkchoiceListener);
    } else {
      LOG.info("TTD difficulty is not present, creating initial sync phase for PoW");
      return new PivotSelectorFromPeers(ethContext, syncConfig, syncState);
    }
  }
Create synchronizer synchronizer.

@param protocolSchedule the protocol schedule
@param worldStateStorageCoordinator the world state storage
@param protocolContext the protocol context
@param ethContext the eth context
@param peerTaskExecutor the PeerTaskExecutor
@param syncState the sync state
@param ethProtocolManager the eth protocol manager
@param pivotBlockSelector the pivot block selector
@return the synchronizer
app/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java