Skip to content

Commit 6bd2d15

Browse files
thinkAfCodGrapeBaBa
authored andcommitted
fix: init l2 refs
1 parent 2ab153b commit 6bd2d15

File tree

1 file changed

+10
-5
lines changed
  • hildr-node/src/main/java/io/optimism/derive

1 file changed

+10
-5
lines changed

hildr-node/src/main/java/io/optimism/derive/State.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import io.optimism.common.Epoch;
55
import io.optimism.config.Config;
66
import io.optimism.driver.HeadInfo;
7+
import io.optimism.driver.L1AttributesDepositedTxNotFoundException;
78
import io.optimism.l1.L1Info;
89
import java.math.BigInteger;
910
import java.util.Map.Entry;
@@ -142,7 +143,7 @@ public Tuple2<BlockInfo, Epoch> l2Info(BigInteger timestamp) {
142143
if (cache != null) {
143144
return cache;
144145
}
145-
146+
LOGGER.warn("L2 refs cache not contains, will fetch from geth: blockNum = {}", blockNum);
146147
var res = l2Fetcher.apply(blockNum);
147148
this.l2Refs.put(res.component1().number(), res);
148149
return res;
@@ -337,10 +338,14 @@ public static TreeMap<BigInteger, Tuple2<BlockInfo, Epoch>> initL2Refs(
337338
if (block == null) {
338339
continue;
339340
}
340-
final HeadInfo l2BlockInfo = HeadInfo.from(block);
341-
l2Refs.put(
342-
l2BlockInfo.l2BlockInfo().number(),
343-
new Tuple2<>(l2BlockInfo.l2BlockInfo(), l2BlockInfo.l1Epoch()));
341+
try {
342+
final HeadInfo l2BlockInfo = HeadInfo.from(block);
343+
l2Refs.put(
344+
l2BlockInfo.l2BlockInfo().number(),
345+
new Tuple2<>(l2BlockInfo.l2BlockInfo(), l2BlockInfo.l1Epoch()));
346+
} catch (L1AttributesDepositedTxNotFoundException ignore) {
347+
LOGGER.debug("Can't found deposited transaction (at blockNum = %d)".formatted(i));
348+
}
344349
}
345350
}
346351
return l2Refs;

0 commit comments

Comments
 (0)