@Override
  public void subscribe() {
    if (syncState == null) {
      return;
    }
    syncState.subscribeSyncStatus(
        syncStatus -> {
          if (syncState.syncTarget().isPresent()) {
            // We're syncing so stop doing other stuff
            LOG.info("Stopping BFT mining coordinator while we are syncing");
            stop();
          } else {
            LOG.info("Starting BFT mining coordinator following sync");
            enable();
            start();
          }
        });

    syncState.subscribeCompletionReached(
        new BesuEvents.InitialSyncCompletionListener() {
          @Override
          public void onInitialSyncCompleted() {
            LOG.info("Starting BFT mining coordinator following initial sync");
            enable();
            start();
          }

          @Override
          public void onInitialSyncRestart() {
            // Nothing to do. The mining coordinator won't be started until
            // sync has completed.
          }
        });
  }
Instantiates a new Bft mining coordinator.

@param bftExecutors the bft executors
@param eventHandler the event handler
@param bftProcessor the bft processor
@param blockCreatorFactory the block creator factory
@param blockchain the blockchain
@param eventQueue the event queue
@param syncState the sync state
consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftMiningCoordinator.java