private CompletableFuture<PeerTaskResult<List<BlockHeader>>> downloadHeader() {
    return executeSubTask(
        () -> {
          final AbstractGetHeadersFromPeerTask task;
          task =
              hash.map(
                      value ->
                          GetHeadersFromPeerByHashTask.forSingleHash(
                              protocolSchedule, ethContext, value, blockNumber, metricsSystem))
                  .orElseGet(
                      () ->
                          GetHeadersFromPeerByNumberTask.forSingleNumber(
                              protocolSchedule, ethContext, blockNumber, metricsSystem));
          assignedPeer.ifPresent(task::assignPeer);
          return task.run();
        });
  }
Downloads a block from a peer. Will complete exceptionally if block cannot be downloaded.
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBlockFromPeerTask.java