private void setOptionalFields(
      final MiningCoordinator miner,
      final BlockData blockData,
      final GenesisConfigOptions genesisConfig) {
    // Some fields can only be configured for ethash
    if (genesisConfig.getPowAlgorithm() != PowAlgorithm.UNSUPPORTED) {
      // For simplicity only set these for PoW consensus algorithms.
      // Other consensus algorithms use these fields for special purposes or ignore them.
      miner.setCoinbase(blockData.getCoinbase().orElse(Address.ZERO));
      controller.getMiningParameters().setExtraData(blockData.getExtraData().orElse(Bytes.EMPTY));
    } else if (blockData.getCoinbase().isPresent() || blockData.getExtraData().isPresent()) {
      // Fail if these fields are set for non-ethash chains
      final Stream.Builder<String> fields = Stream.builder();
      blockData.getCoinbase().map((c) -> "coinbase").ifPresent(fields::add);
      blockData.getExtraData().map((e) -> "extraData").ifPresent(fields::add);
      final String fieldsList = fields.build().collect(Collectors.joining(", "));
      throw new IllegalArgumentException(
          "Some fields ("
              + fieldsList
              + ") are unsupported by the current consensus engine: "
              + genesisConfig.getConsensusEngine());
    }
  }
Import chain.

@param chainJson the chain json
@throws IOException the io exception
app/src/main/java/org/hyperledger/besu/chainimport/JsonBlockImporter.java