class DownloadReceiptsStep implements Function<List<Block>, CompletableFuture<List<BlockWithReceipts>>> {

  @Override
  public CompletableFuture<List<BlockWithReceipts>> apply(final List<Block> blocks) {
    final List<BlockHeader> headers = blocks.stream().map(Block::getHeader).collect(toList());
    final CompletableFuture<Map<BlockHeader, List<TransactionReceipt>>> getReceipts =
        GetReceiptsForHeadersTask.forHeaders(ethContext, headers, metricsSystem).run();
    final CompletableFuture<List<BlockWithReceipts>> combineWithBlocks =
        getReceipts.thenApply(
            receiptsByHeader -> combineBlocksAndReceipts(blocks, receiptsByHeader));
    FutureUtils.propagateCancellation(combineWithBlocks, getReceipts);
    return combineWithBlocks;
  }

  public  DownloadReceiptsStep(final EthContext ethContext, final MetricsSystem metricsSystem);

}