private void updateFinalized(final Hash finalizedHash) {
    // If finalizedHash is already set, do nothing
    if (mergeContext
        .getFinalized()
        .map(BlockHeader::getHash)
        .map(finalizedHash::equals)
        .orElse(Boolean.FALSE)) {
      LOG.atDebug()
          .setMessage("Finalized block already set to {}, nothing to do")
          .addArgument(finalizedHash)
          .log();
      return;
    }

    if (finalizedHash.equals(Hash.ZERO)) {
      LOG.warn("Received zero hash as finalized block. Ignoring...");
      return;
    }

    protocolContext
        .getBlockchain()
        .getBlockHeader(finalizedHash)
        // Check if the finalized block exists in the blockchain
        .ifPresentOrElse(
            finalizedHeader -> {
              LOG.atDebug()
                  .setMessage("Setting finalized block header to {}")
                  .addArgument(finalizedHeader::toLogString)
                  .log();
              mergeContext.setFinalized(finalizedHeader);
            },
            () ->
                LOG.warn(
                    "Internal error, backward sync completed but failed to import finalized block {}",
                    finalizedHash));
  }
Instantiates a new Merge coordinator.

@param protocolContext the protocol context
@param protocolSchedule the protocol schedule
@param ethScheduler the block builder executor
@param miningParams the mining params
@param backwardSyncContext the backward sync context
@param mergeBlockCreatorFactory the merge block creator factory
consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java