From 5788e11bc169ce00a264bd6398ca8893beedae13 Mon Sep 17 00:00:00 2001 From: thinkAfCod Date: Sat, 13 Apr 2024 00:30:55 +0800 Subject: [PATCH] fix: start block should to be checked --- hildr-node/src/main/java/io/optimism/driver/Driver.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hildr-node/src/main/java/io/optimism/driver/Driver.java b/hildr-node/src/main/java/io/optimism/driver/Driver.java index 9e464a58..2e6d7dbf 100644 --- a/hildr-node/src/main/java/io/optimism/driver/Driver.java +++ b/hildr-node/src/main/java/io/optimism/driver/Driver.java @@ -49,6 +49,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.util.stream.Collectors; +import org.apache.commons.collections4.CollectionUtils; import org.jctools.queues.MessagePassingQueue; import org.jctools.queues.MpscUnboundedXaddArrayQueue; import org.jetbrains.annotations.NotNull; @@ -182,7 +183,9 @@ public static Driver from(Config config, CountDownLatch latch) } HeadInfo head; - if (finalizedBlock == null) { + if (finalizedBlock == null + || finalizedBlock.getBlock() == null + || CollectionUtils.isEmpty(finalizedBlock.getBlock().getTransactions())) { LOGGER.warn("could not get head info. Falling back to the genesis head."); head = new HeadInfo( config.chainConfig().l2Genesis(), config.chainConfig().l1StartEpoch(), BigInteger.ZERO); @@ -218,7 +221,7 @@ public static Driver from(Config config, CountDownLatch latch) scope.throwIfFailed(); var block = blockTask.get(); - if (block == null) { + if (block == null || block.getBlock() == null) { return null; } final HeadInfo l2BlockInfo = HeadInfo.from(block.getBlock());