Skip to content

Commit

Permalink
fix: start block should to be checked
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkAfCod authored and GrapeBaBa committed Apr 21, 2024
1 parent 5bc9355 commit 5788e11
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hildr-node/src/main/java/io/optimism/driver/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -182,7 +183,9 @@ public static Driver<EngineApi> 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);
Expand Down Expand Up @@ -218,7 +221,7 @@ public static Driver<EngineApi> 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());
Expand Down

0 comments on commit 5788e11

Please sign in to comment.