@Test
  @Disabled("Provide a replay file to run the test on demand")
  public void replay() throws IOException {
    SignatureAlgorithmFactory.setDefaultInstance();
    try (BufferedReader br =
        new BufferedReader(
            new InputStreamReader(
                new GZIPInputStream(getClass().getResourceAsStream("/tx.csv.gz")),
                StandardCharsets.UTF_8))) {
      currBlockHeader = mockBlockHeader(br.readLine());
      final BaseFeeMarket baseFeeMarket = FeeMarket.london(0L);

      final TransactionPoolConfiguration poolConfig =
          ImmutableTransactionPoolConfiguration.builder()
              .prioritySenders(readPrioritySenders(br.readLine()))
              .maxPrioritizedTransactionsByType(readMaxPrioritizedByType(br.readLine()))
              .build();

      final AbstractPrioritizedTransactions prioritizedTransactions =
          createLayers(poolConfig, txPoolMetrics, baseFeeMarket);
      final LayeredPendingTransactions pendingTransactions =
          new LayeredPendingTransactions(poolConfig, prioritizedTransactions, ethScheduler);
      br.lines()
          .forEach(
              line -> {
                try {
                  final String[] commaSplit = line.split(",");
                  final String type = commaSplit[0];
                  switch (type) {
                    case "T":
                      System.out.println(
                          "T:"
                              + commaSplit[1]
                              + " @ "
                              + Instant.ofEpochMilli(Long.parseLong(commaSplit[2])));
                      processTransaction(commaSplit, pendingTransactions, prioritizedTransactions);
                      break;
                    case "B":
                      System.out.println("B:" + commaSplit[1]);
                      processBlock(commaSplit, prioritizedTransactions, baseFeeMarket);
                      break;
                    case "S":
                      // ToDo: commented since not always working, needs fix
                      // System.out.println("S");
                      // assertStats(line, pendingTransactions);
                      break;
                    case "D":
                      System.out.println("D:" + commaSplit[1]);
                      processInvalid(commaSplit, prioritizedTransactions);
                      break;
                    default:
                      throw new IllegalArgumentException("Unexpected first field value " + type);
                  }
                } catch (Throwable throwable) {
                  fail(line, throwable);
                }
              });
    }
  }
Ignored by default since this is useful to debug issues having a dump of txs that could be
quite big and so could take many minutes to execute. To generate the input file for the test
enable the LOG_FOR_REPLAY logger by adding these parts to the log4j2 configuration: in the
Appenders section add

<pre>{@code
<RollingFile name="txCSV" fileName="/data/besu/tx.csv" filePattern="/data/besu/tx-%d{MM-dd-yyyy}-%i.csv.gz">
   <PatternLayout>
       <Pattern>%m%n</Pattern>
   </PatternLayout>
   <Policies>
       <OnStartupTriggeringPolicy />
   </Policies>
</RollingFile>
}</pre>

in the Loggers section add

<pre>{@code
<Logger name="LOG_FOR_REPLAY" level="TRACE" additivity="false">
   <AppenderRef ref="txCSV" />
</Logger>
}</pre>

restart and let it run until you need it, then copy the CSV in the test resource folder.

@throws IOException when fails to read the resource
ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/ReplayTest.java